我有這個簡單的代碼:
function dlgEditPhase_okClicked(dlgEditPhase, event) {
$.post("/overview/phase/" dlgEditPhase.projectId,
JSON.stringify({
"phaseName": dlgEditPhase.phaseName,
"begin": dlgEditPhase.begin,
"end": dlgEditPhase.end
}),
function(data) {
dlgEditPhase.close();
location.reload();
},
"json"
).fail(function(data) {
alert(data.responseJSON);
});
}
問題是fail,即使 POST 呼叫回傳代碼 200 或 202,總是會觸發 。
我究竟做錯了什么?
uj5u.com熱心網友回復:
Fail 也可以觸發,因為 response 不是有效的 json
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/418164.html
標籤:
