1. Home
  2. Docs
  3. Code Examples
  4. JavaScript (jQuery.ajax)

JavaScript (jQuery.ajax)

// set endpoint and your access key
var ip = '185.245.87.169';
var access_key = 'YOUR_ACCESS_KEY';

// get the API result via jQuery.ajax
$.ajax({
    url: 'https://api.clarifyip.com/?ip=' + ip + '&key=' + access_key,   
    dataType: 'jsonp',
    success: function(json) {

        // output the "latitude" object inside "location"
        alert(json.location.latitude);
        
    }
});

 

Tags , , ,
Was this article helpful to you? Yes No

How can we help?