我想在發生錯誤時添加(默認)的行動,它不是(403,500或410碼):
$.ajaxSetup({
statusCode: {
403: function() {
window.location = '@Url.Action("LogOn", "Account", new {area = "", msg = "forbidden", returnUrl = HttpContext.Current.Request.RawUrl})' + window.location.hash;
},
500: function() {
window.location = '@Url.Action("AccessDenied", "Error")';
},
410: function() {
window.location = '@Url.Action("Deleted", "Error")';
}
// ANY OTHER ERROR CODE - but it doesn't work, how can i do it?
if not any above and it's an error then =>
window.location = '@Url.Action("Index", "Error")';
}
});
但使用ajaxError一些工作,原因打的功能:請參閱:HTTP: //stackoverflow.com/questions/16080462/handling-session-timeout-in-ajax – ShaneKm
@ShaneKm檢查我的更新編輯實際參數 – mattytommo
,但仍然。由於某種原因ajaxError從未被擊中。 http://stackoverflow.com/questions/16080462/handling-session-timeout-in-ajax – ShaneKm