我正在尝试访问一个404事件,用Firebug可以看到它返回404,但错误函数没有启动。以下是我的代码,但我总是得到"Error: success ?"。
例如:
$.ajax({
type: 'get',
url: 'url: 'https://admin.instantservice.com/resources/smartbutton/5702/10945/available.gif?' + Math.floor(Math.random()*10001),
success: function(data, textStatus, XMLHttpRequest){
console.log('Error: ' + textStatus);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(xhr.statusText);
alert(xhr.responseText);
}
});
我很确定我遇到了404 Not Found错误,但在Firebug中它从未触发该错误。
我是否漏掉了什么?
404
)。 - cambracaconsole.log()
,它可以避免 JavaScript 锁死并且不会过于突兀。你可以在 JavaScript 控制台中查看输出结果。 - Fred