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(‘用户拒绝授权获取地理位置‘,‘‘);
}
});
//});

猜你喜欢

转载自blog.csdn.net/tocnc/article/details/84835861
今日推荐