百度定位api

里面有详细的参数设置,要先申请密钥 就是 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('访问出错!');    
            }
        });

高德地图api

申请申请Web服务API类型KEY

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('访问出错!');    
            }
        });

 

posted on 2016-06-29 16:31  浅唱年华1920  阅读(232)  评论(0编辑  收藏  举报