根据IP获取经纬度 js


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" ></script>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script>
function getXYbyIP() { 
var url="https://api.map.baidu.com/location/ip?ak=HQi0eHpVOLlRuIFlsTZNGlYvqLO56un3&coor=bd09ll";
$.ajax({
    url:url,
    type: 'POST', 
    dataType: 'JSONP',
    async: false, 
    cache: true, 
    success: function (data) { 
        console.log(data)
       
    }, 
    error: function (data) { 
    } 
 }); 
}
getXYbyIP();
</script>
</head>
<body>
</body>
</html>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM