<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script type="text/jscript" href="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<style>
body{width:100%; min-height:100%;}
body img{width:100%;}
</style>
<title>关注分享送红包</title>
</head>
<body>
<p id="test">ttttttttttt</p>
<script>
wx.config({
debug: true,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
jsApiList: [
// 所有要调用的 API 都要加到这个列表中
'checkJsApi',
'openLocation',
'getLocation',
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
});
wx.ready(function(){
alert('成功');
})
wx.error(function(res){
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的 debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
$('#test').html(res);
});
$('#test').html("bbbbbbbb");
</script>

加载微信的jssdk后,通过文档提供的wx对象调用,提示wx为undefined
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- black_wizard 2016-05-07 01:57关注
你是不是在pc端调用的,PC端不支持, 放到微信上 或 用微信提供的web开发工具 http://mp.weixin.qq.com/wiki/10/e5f772f4521da17fa0d7304f68b97d7e.html
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用