$(function () {
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);
}
});