1 回答

TA貢獻1804條經(jīng)驗 獲得超7個贊
一直調(diào)用error方法,請求失敗時調(diào)用此函數(shù)。有以下三個參數(shù):XMLHttpRequest 對象、錯誤信息、(可選)捕獲的異常對象。
如果發(fā)生了錯誤,錯誤信息(第二個參數(shù))除了得到null之外,還可能是"timeout", "error", "notmodified" 和 "parsererror"。
參考如下:
$.ajax({
url : "/education2/json/getSearchQuestionknowledgeview",
type: "post",
data : params,
dataType : "json",
cache : false,
error : function(textStatus, errorThrown) {
alert("系統(tǒng)ajax交互錯誤: " + textStatus);
},
.....
調(diào)試停在alert("系統(tǒng)ajax交互錯誤: " + textStatus);處,然后在firebug右邊的監(jiān)控窗口看"textStatus",展開看有詳細錯誤細節(jié).errorThrown中有錯誤類型。
- 1 回答
- 0 關(guān)注
- 617 瀏覽
添加回答
舉報