Reputation: 3370
I have a question regarding .ajaxComplete().
Lets say I do this:
// Register an ajaxComplete (pseudo code ish)
$('#someId').ajaxComplete(function () {
if (ajaxCompleted == isAjaxImWaitingForToComplete) {
// something something
}
});
Then this will be called every time an ajax task finishes. Is there a way to make it only be called once, then unregister? Could I add $('#someId').unbind(); at the bottom of the function inside the ajaxComplete?
Upvotes: 5
Views: 4860
Reputation: 38345
The .ajaxComplete()
function binds a handler for the ajaxComplete
AJAX event, so calling .unbind('ajaxComplete');
should work.
Upvotes: 7