Home >Web Front-end >JS Tutorial >Tencent and Sina's interface for obtaining the current geographical location (province) through IP address_jquery

Tencent and Sina's interface for obtaining the current geographical location (province) through IP address_jquery

WBOY
WBOYOriginal
2016-05-16 18:22:272001browse

Tencent's interface is to return an array http://fw.qq.com/ipaddress
Return value var IPData = new Array("61.135.152.194","","Beijing City","");
Sina's interface: http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js Multi-region testing method: http://int.dpool.sina.com.cn/iplookup/iplookup. php?format=js&ip=218.192.3.42
Return value var remote_ip_info = {"ret":1,"start":"218.192.0.0","end":"218.192.7.255","country":"u4e2du56fd ","province":"u5e7fu4e1c","city":"u5e7fu5dde","district":"","isp":"u6559u80b2u7f51","type":"u5b66u6821","desc":"u5e7fu5ddeu5927u5b66u7ebau7ec7u670du88c5u 5b66u9662"};


Get the corresponding data through jquery

Copy the code The code is as follows:

$.getScript('data interface', function(){
//Tencent: IPData[0] 
 //Sina: remote_ip_info.country
...
} )
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn