知识点:
一 前端js :
ajax请求
ajax.post = function (param) {
var ajaxIns = new XMLHttpRequest();
ajaxIns.open(‘POST’, param.url);
if (param.contentType) {
ajaxIns.setRequestHeader(‘Content-type’, param.contentType)
} else {
ajaxIns.setRequestHeader(‘Content-type’, ‘application/x-www-form-urlencoded’)
}
ajaxIns.withCredentials = true;
ajaxIns.send(null);
ajaxIns.onreadystatechange = function () {
if (ajaxIns.readyState == 4) {
if (ajaxIns.status == 200) {
console.log('------',ajaxIns.response.cookie);
if (param.success) {
param.success(ajaxIns.responseText);
}
} else {
if (param.error) {
param.error();
}
}
}
};
}
需要设置withCredentials 为true,请