$.ajax({
type: "post",
url: "/myerp/api/xxx",
dataType: "json",
data: JSON.stringify(data.field),
async: false,
success: function(res, textStatus, jqXHR) {
console.log(res);
console.log(textStatus);
console.log(jqXHR);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});
用不同的账号,相同的数据,结果一个走success,一个走error, 非常奇怪。
尝试一下,把ajax的dataType注释掉,看看能不能行。
$.ajax({
type: "post",
url: "/myerp/api/xxx",
//dataType: "json",
data: JSON.stringify(data.field),
async: false,
success: function(res, textStatus, jqXHR) {
console.log(res);
console.log(textStatus);
console.log(jqXHR);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});
成功了。