Deferred implementation for jQuery Ajax global handlers
<p>According to jQuery documentation, the <a href="http://api.jquery.com/category/ajax/global-ajax-event-handlers/" rel="nofollow">global Ajax event handlers</a> must be implemented using callback functions on the document. Otherwise, local <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">$.ajax()</a> implement events using <a href="http://api.jquery.com/category/deferred-object/" rel="nofollow">promises</a>.</p>

<p>Is there any way of handling the global Ajax events using promises method, as <a href="http://api.jquery.com/deferred.always/" rel="nofollow">.done()</a>, <a href="http://api.jquery.com/deferred.fail/" rel="nofollow">.fail()</a>, <a href="http://api.jquery.com/deferred.always/" rel="nofollow">.always()</a> and <a href="http://api.jquery.com/deferred.then/" rel="nofollow">.then()</a> ? </p>

<p>I'm looking for a way for declaring event handlers for global ajax events that do not depend on <code>$(document)</code>, for example:</p>

<pre><code>// current way of doing this:
// $(document).ajaxSuccess(_handleAjaxSuccess);
// 
// some ideas of what it could look like:
// $.ajaxSuccess(_handleAjaxSuccess);
// $.ajax.done(_handleAjaxSuccess);
// $.ajaxSetup({ done: _handleAjaxSuccess });
</code></pre>