jQuery ajaxComplete called every time?

ajax, javascript, jquery

Solution

The `.ajaxComplete()` function binds a handler for the `ajaxComplete` AJAX event, so calling `.unbind('ajaxComplete');` should work.

Problem

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?

Original source