我正在向我的 jQuery 发送错误响应。但是,我无法获得响应文本(在下面的示例中,这将是Gone to the beach)
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]
警报:
不能做,因为:错误
有任何想法吗?