//alert('wx10b5f398fae61079'); // alert('35.411995'); wx.config({ debug: false, appId: 'wx10b5f398fae61079', timestamp:1716088755, nonceStr: '323ee3992e46ee28ff714be095875b92', signature: '9D1A8A5ABE5FEC9229699D1536A431DF5F9A9F5E', jsApiList: [ 'openLocation', 'getLocation' ] }); wx.ready(function () { wx.getLocation({ type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入’gcj02’ success: function (res) { var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ - var longitude = res.longitude;// 经度,浮点数,范围为180 ~ -180。 var speed = res.speed; // 速度,以米/每秒计 var accuracy = res.accuracy; // 位置精度 //alert(latitude); var data="x1="+latitude+"&y1="+longitude+"&x2=35.411995&y2=116.96733&hitid=179600"; var url="/api/GPSDistance?"+data; $.ajax({ type: "POST", url: url, data: data, success: function (data1) { popMessage("距扫码点"+data1+"米"); //获得距离 // $("#ctl_GPSDistance").val(data1); // $("#ctl_GPSDistancelable").text(data1+"米"); // alert(data1+"米"); }, error: function (message) { popMessage(data+'数据加载异常'+message); } }); //$("#tb_X").val(latitude); //$("#tb_Y").val(longitude); /// $.ajax({ // url: "http://apis.map.qq.com/ws/geocoder/v1/?location="+latitude+","+longitude+"&coord_type=5&key=你自己的腾讯开放平台的开发者秘钥&output=jsonp&callback=calllocation", // type:"GET", // dataType:'jsonp', // jsonp:'calllocation' // }); }, cancel: function (res) { alert('用户拒绝授权获取地理位置'); } }); });