$.ajaxSetup is used for ajax call in jquery. This works perfectly fine if we use jquery ajax.
But in MVC we use Ajax.BeginForm() .the callback handlers are OnFailure,OnSuccess,OnBegin.
Is there a way we can use $.ajaxSetup for Ajax.BeginForm().
Update
eg I have used Ajax.BeginForm() in 10 places but instead of writing OnFailure handler for all i just want to write a single common OnFailure in common place like jquery $.ajaxSetup. Is there a way of doing it?
Quote from the documentation of $.ajaxSetup
:
Note: Global callback functions should be set with their respective global Ajax event handler methods - .ajaxStart(), .ajaxStop(), .ajaxComplete(), .ajaxError(), .ajaxSuccess(), .ajaxSend() - rather than within the options object for $.ajaxSetup().
So as suggested, use the corresponding global AJAX event handlers such as .ajaxError()
for example if you want to handle all your AJAX errors globally:
$(document).ajaxError(function () {
console.log('oopsy');
});