To get the client IP address & country name in jQuery:
$.getJSON("http://freegeoip.net/json/", function(data) {
var country_code = data.country_code;
var country = data.country_name;
var ip = data.ip;
var time_zone = data.time_zone;
var latitude = data.latitude;
var longitude = data.longitude;
alert("Country Code: " + country_code);
alert("Country Name: " + country);
alert("IP: " + ip);
alert("Time Zone: " + time_zone);
alert("Latitude: " + latitude);
alert("Longitude: " + longitude);
});
$.get("http://freegeoip.net/json/", function (response) {
$("#ip").html("IP: " + response.ip);
$("#address").html("Location: " + response.city + ", " + response.region_name);
$("#details").html(JSON.stringify(response, null, 4));
}, "jsonp");
Client side IP geolocation using freegeoip.net
Full response: