ip-api.com
by webproger on 2020-03-19
var endpoint = 'http://ip-api.com/json/?fields=status,message,country';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        var response = JSON.parse(this.responseText);
        if(response.status !== 'success') {
            console.log('query failed: ' + response.message);
            return
        }
        jif.cy = response.country;
    }
};
xhr.open('GET', endpoint, true);
xhr.send();