我想在发生错误但不是(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")';
}
});