asp.net - Get the respective country code as well as IP address using jQuery -



asp.net - Get the respective country code as well as IP address using jQuery -

i working in asp.net project , stuck have country name ip address of particular computer visiting website.

i have tried

jquery.getjson('http://freegeoip.net/json/', function (location) { alert(location.country_name); });

but giving me republic of india , need country.

the result based on country create request based on ip address. if testing in india, see. personally, see united kingdom country name; in fact, here total response:

{ "ip": "xxx.xxx.xxx.xxx", // redacted "country_code": "gb", "country_name": "united kingdom", "region_code": "", "region_name": "", "city": "", "zipcode": "", "latitude": 51.5, "longitude": -0.13, "metro_code": "", "area_code": "" }

but want see visitor of website. user cant see own location. if u r hitting united kingdom of britain and northern republic of ireland details country_name,city,and ip visted ur website

i case need utilize ajax client send country info server when ip lookup has completed. this:

jquery.getjson('http://freegeoip.net/json/', function (location) { $.ajax({ url: 'http://yourwebsite/tracking/', method: 'post', data: location, // or create new object properties need success: function(response) { // worked. }, error: function(xhr, status, error) { // didn't work } }); });

jquery asp.net

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -