If you're using Microsoft's unobtrusive ajax library with your MVC3 project, you might come across a problem if you're trying to add an error handler to one of your Ajax.BeginForm or Ajax.ActionLink calls.
The problem lies in the library's handling of the data-ajax-failure attribute that gets added to an ajax form/link. Basically, the library just doesn't execute the method after finding it. The problem line of code is line 98 of jquery.unobtrusive-ajax.js:
$.extend(options, {
// other handler code removed
error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"])
});
To fix this, you need to change line 98 to this:
$.extend(options, {
error: function() {
getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]).apply(this, arguments);
}
});