ajax 初始化请求前携带参数
function SetAjax(wxOpenId, departCode) {
$.ajaxSetup({
xhrFields: {
withCredentials: true
},
beforeSend: function (o) {
if (wxOpenId && departCode) {
o.setRequestHeader(‘wxOpenId‘, " " + wxOpenId);
o.setRequestHeader(‘DepartCode‘, " " + departCode);
}
}
});
}
var wxOpenId = App.GetQueryStringByName("wxOpenId");
var DepartCode = App.GetQueryStringByName("DepartCode");
if (!wxOpenId) {
wxOpenId = App.GetCookie("wxOpenId");
} else {
App.SetCookie("wxOpenId", wxOpenId, 365);
}
if (!DepartCode) {
DepartCode = App.GetCookie("DepartCode");
} else {
App.SetCookie("DepartCode", DepartCode, 365);
}
if (wxOpenId && departCode){
SetAjax(wxOpenId, departCode);
}
});
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。