5

I tried doing $.ajaxStart(function(){}), but it does not replace it, but appended.

Nic
  • 12,220
  • 20
  • 77
  • 105
kaneda
  • 5,981
  • 8
  • 48
  • 73

4 Answers4

14

If I understand, you want to remove the ajaxStart handler from the element.

If so, just use jQuery's unbind() since the handler is attached as an event.

$('selector').unbind('ajaxStart');
user113716
  • 318,772
  • 63
  • 451
  • 440
2

Set global option to false

$.ajaxSetup({ global: false });

http://api.jquery.com/jQuery.ajaxSetup/

kien ngo doan
  • 86
  • 1
  • 1
2

Worth to note that since jQuery 1.9, the .ajaxStart() must be attached to the document, hence you can't attach it to an element, or unbind from an element other than document for that matter:

As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with the .ajaxStart() method, must be attached to document.

Hamid Mosalla
  • 3,279
  • 2
  • 28
  • 51
1

This worked for me.

$(document).ready(function () {
   $(document).unbind('ajaxStart');
   $(document).unbind('ajaxStop');
 });