|
返回值 var IPData = new Array("61.135.152.194","","北京市","");
新浪的接口 : http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 多地域測試方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.192.3.42
返回值 var remote_ip_info = {"ret":1,"start":"218.192.0.0","end":"218.192.7.255","country":"/u4e2d/u56fd","province":"/u5e7f/u4e1c","city":"/u5e7f/u5dde","district":"","isp":"/u6559/u80b2/u7f51","type":"/u5b66/u6821","desc":"/u5e7f/u5dde/u5927/u5b66/u7eba/u7ec7/u670d/u88c5/u5b66/u9662"};
通過jquery 獲取相應(yīng)的數(shù)據(jù)
復(fù)制代碼 代碼如下:
$.getScript('數(shù)據(jù)接口',function(){
//騰訊:IPData[0]
//新浪:remote_ip_info.country
...
})
JavaScript技術(shù):騰訊與新浪的通過IP地址獲取當(dāng)前地理位置(省份)的接口,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。