02
2018
11

asp微信公众号获取用户地址信息源码,可以获取省市县及坐标

//获取定位
//$(".getLocation").on("click", function(){
wx.getLocation({
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function (res) {
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
$("#p_LatLng").html(longitude+','+latitude); //用户的坐标
var url='GetAddress.asp?lat='+latitude+'&lng='+longitude;
$.ajax({
type:"get",
cache:false,
url:url,
success:function(res)
{
$("#p_Address").html(res); //中文地址

}
});
},
cancel: function (res) {
alert('用户拒绝授权获取地理位置','');
}
});
//});

« 上一篇下一篇 »