我一生都无法解决这个问题...我有以下简单的div块:
<div id="result">Loading...</div>
以及以下简单的JQuery代码:
$.ajax({
cache: false,
url: "/bogus-url",
method: "GET",
success: function(data) {
$("#result").html(data);
},
error: function(xhr) {
$("#result").html('Error occurred: ' + xhr.status + ' ' + xhr.statusText);
}
});
在一台机器上运行它会得到
Error occurred: 404 Not Found
但是,当我在另一台机器上运行它时,会得到
Error occurred: 404 error
事实上,我已经创建了一个JSFiddle来证明这一点。我很好奇你们运行它时会得到哪个版本。有谁知道会导致这种行为差异的原因?