ajax 跨域错误问题
$.ajax({
url: formUrl,
type: 'post',
dateType: 'json',
data: postData,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
},
xhrFields: {
withCredentials: true
},
success: function(data) {
data = JSON.parse(data);
console.log('res=>', data);
if (data.code == 1) {
alert(data.message);
}
if (data.code == 200) {
sessionStorage.userInfo = JSON.stringify(data.data);
window.location.href = './list.html';
}
changeCode();
},
error: function() {
console.log('err');
},
});