Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

 

Code Block
languagejs
var s = document.createElement( 'script' );
s.setAttribute( 'src', "https://res.wx.qq.com/open/js/jweixin-1.2.0.js" );
s.onload=function(){
    var url = contextPath+"/weixin/signinfo.do";
	$.ajax({
		type: 'post',
		url: url,
		dataType: "json",
		traditional: true,
		data: {url: window.location.href},
		success: function(resp){
		    if(resp.success) {
		        var configData = resp.data;
		        wx.ready(function(){
                    wx.hideOptionMenu();
                });
		        wx.config({
                    beta: true,
                    debug: false,
                    appId: configData.appId, 
                    timestamp: configData.timestamp, 
                    nonceStr: configData.nonceStr,
                    signature: configData.signature,
                    jsApiList: ["hideOptionMenu"]
                });
		    }
		}
	});
};
document.head.appendChild( s );