var url = "http://iplocationtools.com/ip_query.php?output=json&callback=?&ip="+ipno;
// Utilize the JSONP API
$.getJSON(url, function(data){
if(data['status'] == 'ok'){
// Do something with the data
$('#profile #ip')
.html(data['IP']);
$('#profile #country')
.html(data['CountryName']);
}
});
//kullanımı
<div id=#profile>
<div id=#ip></div>
<div id=#country></div>
</div>
json ile gelen değerler:
{
'status':'ok',
'IP': '74.125.45.100',
'CountryCode': 'US',
'CountryName': 'United States',
'RegionName': 'California',
'ZipPostalCode': '94043',
'City': 'Mountain View',
'Latitude': '37.4192',
'Longitude': '-122.057'
}
// In case of an error
{
'status':'parent server not responding'
} |