I have a problem, when submitting a form all active ajax request fail, and that triggers error event.
How to stop all active ajax requests in jQuery without trigerri
Here's how to hook this up on any click (useful if your page is placing many AJAX calls and you're trying to navigate away).
$ ->
$.xhrPool = [];
$(document).ajaxSend (e, jqXHR, options) ->
$.xhrPool.push(jqXHR)
$(document).ajaxComplete (e, jqXHR, options) ->
$.xhrPool = $.grep($.xhrPool, (x) -> return x != jqXHR);
$(document).delegate 'a', 'click', ->
while (request = $.xhrPool.pop())
request.abort()