asp.net mvc 3 - $.ajaxSetup for Ajax.BeginForm -


$.ajaxsetup used ajax call in jquery. works fine if use jquery ajax.

but in mvc use ajax.beginform() .the callback handlers onfailure,onsuccess,onbegin.

is there way can use $.ajaxsetup ajax.beginform().

update

eg have used ajax.beginform() in 10 places instead of writing onfailure handler want write single common onfailure in common place jquery $.ajaxsetup. there way of doing it?

quote documentation of $.ajaxsetup:

note: global callback functions should set respective global ajax event handler methods - .ajaxstart(), .ajaxstop(), .ajaxcomplete(), .ajaxerror(), .ajaxsuccess(), .ajaxsend() - rather within options object $.ajaxsetup().

so suggested, use corresponding global ajax event handlers such .ajaxerror() example if want handle ajax errors globally:

$(document).ajaxerror(function () { console.log('oopsy'); }); 

Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -