JS get country, province, city
Recently, found a very powerful function, directly through the JS can be obtained to the country, province, city. The invocation method is simple.
By calling the "Http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" API to view the way
<script type= "Text/javascript" src= "jquery-1.9.0.min.js" ></script><script type= "Text/javascript" language= "JavaScript" >var province = "var country ="; Jquery.getscript ("http://int.dpool.sina.com.cn/iplookup/ Iplookup.php?format=js ", function () {province = remote_ip_info[" province "];country = remote_ip_info[" Country "]; document.write ("Country:" +country + ", Province:" +province);}); </script>
Call JS to return the result
var remote_ip_info = {"ret": 1, "Start":-1, "End":-1, "Country": "\u4e2d\u56fd", "Province": "\u4e0a\u6d77", "City": "\ U4e0a\u6d77 "," District ":" "," ISP ":" "," type ":" "," desc ":"};
You can get the properties inside by Remote_ip_info objects:
For example: urban var city = remote_ip_info["Cities";
Browser-side JS positioning function