Is jQuery ajaxComplete called every time?

I have a question regarding .ajaxComplete ().

Suppose I do this:

// Register an ajaxComplete (pseudo code ish)
$('#someId').ajaxComplete(function () {
    if (ajaxCompleted == isAjaxImWaitingForToComplete) {
        // something something
    }
});

This will then be called every time the ajax task finishes. Is there a way to do this only once and then unregister? Can I add $ ('# someId'). Unbind (); at the bottom of the function inside ajaxComplete?

+3
source share
1 answer

The function .ajaxComplete()binds an ajaxComplete AJAX event handler , so the call .unbind('ajaxComplete');should work.

+3
source

All Articles