Based on user ip address we can show the location
Try this
$.get("http://ipinfo.io", function(response) {
alert(response.loc);
}, "jsonp");
For Country Code,Name
$(window).load(function(){
jQuery.getJSON('http://freegeoip.net/json/', function(location) {
alert(location.country_code);
alert(location.country_name);
});
});