I have a large table of "supplemental" data that is filled in from a large number of ajax requests on page load. These requests can take upwards of 1 minute to complete. While this data is loading the user can perform actions on the page that call additional ajax requests. The problem I encounter is the user action that calls an additional ajax request does not complete until all other ajax requests in the queue have processed. This is due to all same-domain browser connections being used and the jQuery ajax queue.
Unfortunately, changing sub-domains is not an option, nor is setting up a synchronous queue in order to not use all same domain connections.
What I would like is an option to "prioritize" the requests, placing the user request first.
Is there a simple way to accomplish this with jQuery's ajax queue?
EDIT:
If there is not a way to manage the request queue (as it is starting to appear), can the $.ajax function callback beforeSend be used to "postpone" the queued requests?
Once a request is dispatched, it's up to the server to handle it. Since it's asynchronous, you have no control over when the response will be received and in which order. Nor is the server even really "aware" that other requests are pending for the same session...You could probably change this, but it would require quite a bit of work on how the web server manages requests.
The only thing you can really do is prevent the user from interacting until all the data has loaded.