0

In my project,they use below jquery code, which calls ajaxLoader.gif for every ajax call

$().ready(function() {
    $(document).ajaxStart(function() {
            $.blockUI({ css: { border: '0px none #aaa', backgroundColor:'transparent'}, message: '<img src="../common/images/ajaxLoader.gif" alt="Loading" />', overlayCSS:  { backgroundColor: '#08275d', opacity: 0.6 }});
        }
    ).ajaxStop($.unblockUI);
});

I need to prevent this at only one place. The user doesn't want this ajaxLoader.gif to appear at one place where the ajax call is getting fired.

Do i need to add any code snippet before the ajax call and can i suppress this ajaxstart function there ??

Arun
  • 3,440
  • 11
  • 60
  • 108

1 Answers1

4

At this one place, set option global to false, so ajaxStart won't be fired.

Source: http://api.jquery.com/ajaxStart/

If $.ajax() or $.ajaxSetup() is called with the global option set to false, the .ajaxStart() method will not fire.

iappwebdev
  • 5,880
  • 1
  • 30
  • 47
  • http://stackoverflow.com/questions/3365456/how-can-i-unregister-a-handler-set-to-jquery-ajaxstart-function – Arun Apr 09 '13 at 08:56
  • 1
    I guess you will have problems if selector has multiple `ajaxstart` event. If you are going with `unbind` consider using a namespace: http://stackoverflow.com/questions/1191485/how-to-call-ajaxstart-on-specific-ajax-calls/1212728#1212728 – iappwebdev Apr 09 '13 at 09:18