My page sends several HTTP requests in background. The requests are triggered by some user actions. Some user actions can cause redirect – and here we have a problem: we want redirect to happen only when all the requests were sent.
The question is: is there any Javascript library you can recommend that would allow to wait for all the reports to be sent and trigger redirect only after?
You want to use jQuery Deferred pattern which allows you to chain (AJAX) objects and
have success callback if all complete succesfully
have fail callback if any of the requests fails
http://api.jquery.com/category/deferred-object/
Example:
How to chain ajax calls using jquery