Country.is

Country.is is an open-source geolocation API that returns the country of the querying web browser in JSON format.

var demo = function(data) {
  alert(JSON.stringify(data))
}

$.getJSON("http://api.country.is", demo)