Delete the event handler used by .ajaxStop

If I attach an event handler using .ajaxStop like this:

$(document).ajaxStop(function() {
    //Some code
});

How to remove an event handler?

+5
source share
3 answers

Try untying it like this:

$(document).ajaxStop(function () {
    $(this).unbind("ajaxStop");
    //Some code
});

How did i do it.

+12
source

to use . off ()

Remove the event handler.

$("#elementID").off()

this removes all event handlers from the selected item

+3
source

, ajaxStop() , , :

$(document).ajaxStop(function(){    
    // Functions there

    $(this).unbind("ajaxStop");
});

, $.ajax , , ajaxStop(). jQuery.

0

All Articles