根据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>