如何獲得jQuery$.ajax錯誤響應文本?我將向jQuery發送錯誤響應。但是,我無法獲得響應文本(在下面的示例中,這將是去海灘)jQuery唯一說的是“錯誤”。有關詳細信息,請參閱此示例:PHP<?
header('HTTP/1.1 500 Internal Server Error');
print "Gone to the beach"?>jQuery$.ajax({
type: "post",
data: {id: 0},
cache: false,
url: "doIt.php",
dataType: "text",
error: function (request, error) {
console.log(arguments);
alert(" Can't do because: " + error);
},
success: function () {
alert(" Done ! ");
}});現在我的結果列表:日志: [XMLHttpRequest readyState=4 status=500, "error", undefined]警報:不能做,因為:錯誤有什么想法嗎?
如何獲得jQuery$.ajax錯誤響應文本?
qq_遁去的一_1
2019-07-17 10:09:03
