<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){
}
})
}
});
})
}