$.ajax({ url: '/cxz/add', success: function (data) { alert(data); }, error: function (xhr, textStatus, errorThrown) { /*錯誤信息處理*/ alert("進入error---"); alert("狀態碼:"+xhr.status); alert("狀態:"+xhr.readyState);//當前狀態,0-未初始化,1-正在載入,2-已經載入,3-數據進行交互,4-完成。 alert("錯誤信息:"+xhr.statusText ); alert("返回響應信息:"+xhr.responseText );//這裏是詳細的信息 alert("請求狀態:"+textStatus);
alert(errorThrown);
alert("請求失敗");
}
});
詳細介紹ajax