I'm using pace.js (which is like the top loading bar from youtube) for the loading bar on my web page, and to detect the ajax requests I use:
$(document).ajaxStart(function() { Pace.restart(); });
Which executes the pause bar when the request starts, but obviously the start delay takes less time than processing the request and causes the bar to be animated but the animation ends before the request is executed completely.
Maybe they do not know pace, so my question may also be, what event did I capture so that the animation matches the total duration of the jquery's Ajax request ?, thanks