美文网首页
2019-01-24 微信端获取用户地址

2019-01-24 微信端获取用户地址

作者: jakeliukai | 来源:发表于2019-01-24 10:08 被阅读0次

<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>

function getAddress(){

// var map = new AMap.Map('null',{

    //            resizeEnable: true,

    //            zoom: 13,

    //    });

wx.ready(function(){

wx.getLocation({

    type : 'gcj02',

    success : function(res) {

        latitude = res.latitude; // 纬度,

        longitude = res.longitude; // 经度,

        var speed = res.speed; // 速度,以米/每秒计

        var accuracy = res.accuracy; // 位置精度

        console.log(res,22222)

        var data = {

      location:latitude+','+longitude,

      key:"GMWBZ-I3VWU-LOGVT-456N7-JF6QS-6MBKN",

      get_poi:0

        }

        var url="https://apis.map.qq.com/ws/geocoder/v1/?";

        data.output="jsonp";

        $.ajax({

        type:"get",

        dataType:'jsonp',

        data:data,

        jsonp:"callback",

        jsonpCallback:"QQmap",

        url:url,

        success:function(res){

        console.log(res)

        cityName = res.result.address_component.city;

        address = res.result.address;

        },error:function(err){

        }

        })

    }

});

})

}

相关文章

网友评论

      本文标题:2019-01-24 微信端获取用户地址

      本文链接:https://www.haomeiwen.com/subject/vgfyjqtx.html