ip




function getJSONP(url, success) {

var ud = ‘_’ + +new Date,
script = document.createElement(‘script’),
head = document.getElementsByTagName(‘head’)[0]
|| document.documentElement;

window[ud] = function(data) {
head.removeChild(script);
success && success(data);
};

script.src = url.replace(‘callback=?’, ‘callback=’ + ud);
head.appendChild(script);

}

getJSONP(‘http://freegeoip.net/json/’, function(data){
console.log(data);
});