• ASP微信开发获取用户经纬度


    wx.config({
    //debug: true,
    debug: true,
    appId: '<%= appId %>',
    timestamp: '<%= timestamp %>',
    nonceStr: '<%= nonceStr %>',
    signature: '<%=signature %>',
    jsApiList: [
    'checkJsApi',
    'onMenuShareTimeline',
    'onMenuShareAppMessage',
    'onMenuShareQQ',
    'onMenuShareWeibo',
    'hideMenuItems',
    'showMenuItems',
    'hideAllNonBaseMenuItem',
    'showAllNonBaseMenuItem',
    'translateVoice',
    'startRecord',
    'stopRecord',
    'onRecordEnd',
    'playVoice',
    'pauseVoice',
    'stopVoice',
    'uploadVoice',
    'downloadVoice',
    'chooseImage',
    'previewImage',
    'uploadImage',
    'downloadImage',
    'getNetworkType',
    'openLocation',
    'getLocation',
    'hideOptionMenu',
    'showOptionMenu',
    'closeWindow',
    'scanQRCode',
    'chooseWXPay',
    'openProductSpecificView',
    'addCard',
    'chooseCard',
    'openCard'
    ]
    });

    wx.ready(function () {
    wx.getLocation({
    type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
    success: function (res) {
    var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
    var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
    var speed = res.speed; // 速度,以米/每秒计
    var accuracy = res.accuracy; // 位置精度
    alert("纬度:" + latitude + "-" + "经度:"+longitude);

    }
    });
    });
    wx.error(function (res) {

    // alert("wx.config信息验证失败");

    // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
    });

  • 相关阅读:
    MHA-Atlas-MySQL高可用(上)
    MySQL数据库企业级应用实践(主从复制)
    MySQL数据库企业级应用实践(多实例源码编译)
    MySQL存储引擎
    MySQL索引与事务
    MySQL数据备份
    MySQL数据库操作
    bzoj 1038: [ZJOI2008]瞭望塔
    bzoj 2451 Uyuw's Concert
    poj 2187 Beauty Contest
  • 原文地址:https://www.cnblogs.com/yyangjing/p/6952121.html
Copyright © 2020-2023  润新知