作者:萧俊瑄俊明纬伦 | 来源:互联网 | 2017-05-14 02:18
![jsapialert出来的返回值图片说明](img.ask.csdn.netupload201508031438568586_134530.jpg)vargetLocationdocument.getElementById('getLocation');getLocation.onclickfunction(){使用getLocation接口获取地理位置坐标wx.getLocation({success:function
php微信
var getLocation = document.getElementById('getLocation');
getLocation.Onclick= function(){
//使用getLocation接口获取地理位置坐标 wx.getLocation({ success:function(res){ var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90 var lOngitude= res.longitude; // 经度,浮点数,范围为180 ~ -180。 var speed = res.speed; // 速度,以米/每秒计 var accuracy = res.accuracy; // 位置精度 alert(JSON.stringify(res)); }, cancel:function(res){ alert('用户拒绝授权获取地理位置'); }, }); };