里面有详细的参数设置,要先申请密钥 就是 ak
var url = 'http://api.map.baidu.com/location/ip?ak=494PEuZs8md8xKnsIvrYYmvq&coor=bd09ll'; $.ajax({ type:"get", url:url, dataType:'jsonp',//跨域 success:function(msg){ console.log(JSON.stringify(msg)); },error:function(){ alert('访问出错!'); } });
var url = 'http://restapi.amap.com/v3/ip?output=json&key=30cc45850d8d09136aa41a80e01e7af6'; $.ajax({ type:"get", url:url, success:function(msg){ console.log(JSON.stringify(msg)); },error:function(){ alert('访问出错!'); } });