$.ajax({
beforeSend: function(xhr) {
xhr.setRequestHeader("companyId", "1");
},
type: "post",
url: base_url + "visitor/insertVisitorByCode",
data: params, //
dataType: 'json',
xhrFields: {
withCredentials: true
},
crossDomain: true,
success: function(data) {
console.log("提交返回数据");
console.log(data);
if(data.code == "WX5000") {
setTimeout(function() {
toastr.info("请勿重复邀请");
return false;
}, 1000);
} else if(data.code == "411") {
setTimeout(function() {
toastr.info("该组织中不存在接待人");
return false;
}, 1000);
} else if(data.code == "AUTH0000") {
toastr.info("登记成功");
setTimeout(function() {
// 先清空之前的缓存
localStorage.clear();
localStorage.setItem('info', JSON.stringify(info));
window.location.href = "autoInfo.html";
}, 1000);
};
}
});
下面是运行结果