我試圖訪問一個404事件,我可以看到404與螢火蟲回來,但錯誤函數不踢,與我的下面的代碼,我總是得到錯誤:成功?jQuery Ajax 404 Handling
即。
$.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);
}
});
我再次知道1000%即時通訊404在螢火蟲沒有找到它從來沒有觸發錯誤。
我錯過了什麼嗎?
我測試了完全相同的代碼和正確地得到了3個錯誤警報(第一個是'404`)。 – cambraca 2010-11-25 22:34:18
你確定你實際得到了狀態碼404的響應,而不僅僅是狀態碼200的常規響應和包含文本的頁面這是一個404? – Guffa 2010-11-25 22:40:20
@cambraca同樣在這裏。使用Firefox 3.6.12和Firebug進行測試。 – aefxx 2010-11-25 22:41:24