zoukankan      html  css  js  c++  java
  • 微信公众号,获取定位

    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript">
    //配置信息验证接口
    wx.config({
      debug: false,
      appId: '{$wx.appId}',
      timestamp: '{$wx.timestamp}',
      nonceStr: '{$wx.nonceStr}',
      signature: '{$wx.signature}',
      jsApiList: [
        // 所有要调用的 API 都要加到这个列表中
        'checkJsApi',
        'openLocation',
        'getLocation'
       ]
          });
    //验证之后进入该函数,所有需要加载页面时调用的接口都必须写在该里面
    wx.ready(function () {
    //基础接口判断当前客户端版本是否支持指定JS接口
    wx.checkJsApi({
      jsApiList: [
        'getLocation'
      ],
      success: function (res) {
        // alert(JSON.stringify(res));
        // alert(JSON.stringify(res.checkResult.getLocation));
        if (res.checkResult.getLocation == false) {
          alert('你的微信版本太低,不支持微信JS接口,请升级到最新的微信版本!');
          return;
        }
      }
    });
             //微信获取地理位置并拉取用户列表(用户允许获取用户的经纬度)
    wx.getLocation({
      success: function (res) {
        var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
        var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
    	//alert("bbbbbbb");
    	$.ajax({
    		url : 'ajax.php?act=shoplist',
    		data:{latitude:latitude,longitude:longitude},
    		cache : false,
    		async : true,
    		type : "POST",
    		dataType : 'text',
    		success : function (result){
    			console.log("111111");
    			//alert(result);
    		}
    	});
      },
      cancel: function (res) {
      	alert("111111111");
      }
            });
          });
    </script>
    

      

  • 相关阅读:
    【20111012】数据库因机器名被修改无法成功发布问题
    SQL Server 2008 r2 bpa 安装
    A faster DBCC CHECKDB? By Ian Stirk, 2011/08/23
    SQL Server 2005 性能故障白皮书
    Best Practices Analyzer Tool for Microsoft SQL Server 2000
    top详细使用说明
    SQLIO测试 SAN
    数据库事务发布性能调整
    查询优化建议
    证书配置数据库镜像 demo from msdn
  • 原文地址:https://www.cnblogs.com/microtiger/p/12955827.html
Copyright © 2011-2022 走看看