$(function () {
$.ajax({
async:false,
url:"/getwechatparams",
type:"POST",
data: {"url": window.location.href
},
dataType:"json",
success: function (bal) {
wx.config({
debug:false, //开启调试模式,调用的所有api的返回值会在客户端alert出来
appId: bal.appId, //必填,公众号的唯一标识
timestamp: bal.timestamp, //必填,生成签名的时间戳
nonceStr: bal.nonceStr, //必填,生成签名的随机串
signature: bal.signature,//必填,签名,见附录1
jsApiList: ['openLocation', 'getLocation'] //必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
wx.ready(function () {
wx.getLocation({//获取微信接口中的当前坐标经纬度
type: 'wgs84', //GPS坐标
success: function (res) {//alert("gps转换前:" + res.longitude + "," + res.latitude)