<script src="/jquery.min.js"></script>
<script src="/jweixin-1.0.0.js"></script>
<script>
var url = location.href;
url = url.replace(/&/g, "(");
$.ajax({
type: "get",
url: "http://www.c3w.com.cn/jssdk.php?url=" + url,
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "success_jsonpCallback",
success: function (data) {
if (data.errcode) {
alert(data.errmsg);
return;
}
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: [
"onMenuShareTimeline",
"onMenuShareAppMessage",
"onMenuShareQQ"
]
});
},
error: function (data) {
alert("连接失败,请检查第17行的url:文件名或者文件路径是否正确!");
}
});
wx.ready(function () {
var shareData = {
title: '有戏科技',
desc: '一站式服务',
link: location.href,
imgUrl: 'http://www.c3w.com.cn/m/uppic/xiaotu/20158222342074304.jpg'
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQZone(shareData);
});
</script>
标签:function,www,url,微信,shareData,分享,data,wx From: https://blog.51cto.com/jing/6002482