is there any way of ignoring the options set with $.ajaxSetup for a specific request?
A:
There isn't any built-in functionality to do this. The very first thing any $.ajax()
call does is merge options with $.ajaxSettings
, there's no bypass for this.
Any of the $.ajax()
shorthand methods (.load()
, $.post()
, etc) are still calling $.ajax()
underneath, so they're in the same boat.
Nick Craver
2010-08-30 15:06:14
A:
This is kludgey but should work:
var origAjaxSettings = {};
function ajaxSettingsDisable() {
jQuery.extend(origAjaxSettings, jQuery.ajaxSettings);
jQuery.ajaxSettings = {};
}
function ajaxSettingsEnable() {
jQuery.extend(jQuery.ajaxSettings, origAjaxSettings);
origAjaxSettings = {};
}
//ajax request of any sort
ajaxSettingsDisable();
$.ajax({
//Ajax request settings
});
ajaxSettingsEnable();
This could be extended to make it a jQuery plug-in.
Gutzofter
2010-08-30 17:32:33
jQuery ajax settings don't have all options by default, for example if you added a `success` handler it would still apply :)
Nick Craver
2010-08-31 00:53:15