ajax錯誤時,回傳error message內容
ajax錯誤時,回傳的error message內容
$.ajax({
url: '@Url.Action("ST0401R", "ST04")',
type: "post",
...
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
return false;
}
});
xhr是XMLHttpRequest物件,有以下屬性及方法
1.status :Returns the HTTP status code.
2.statusText :Returns the HTTP status text.
3.getResponseHeader() method
4.getAllResponseHeaders() method Response Entity Body
5.response :Returns 就回傳內容
6.responseXML :Returns 就回傳XML內容
參考網址:
ajax錯誤時,回傳的error message內容 http://fishjerky.blogspot.tw/2010/06/ajaxerror-message.html
1.status :Returns the HTTP status code.
2.statusText :Returns the HTTP status text.
3.getResponseHeader() method
4.getAllResponseHeaders() method Response Entity Body
5.response :Returns 就回傳內容
6.responseXML :Returns 就回傳XML內容
參考網址:
ajax錯誤時,回傳的error message內容 http://fishjerky.blogspot.tw/2010/06/ajaxerror-message.html
留言
張貼留言