View Full Version : How to group multiple Ajax requests into a single batch request?

23 Jan 2013, 2:16 AM
For example, I needs to send two requests A and B within a very short time period to the server. I want to group Request A and B into a single request and sends them to the server and expects that the server responds in one response, which includes Response A and Response B.

Is that possible? How to achieve that?


28 Jan 2013, 1:47 PM
Use Direct. Or instead of using Ext.Ajax use a method that will add requests to a queue and then loop through that queue to build a single request.

28 Jan 2013, 8:09 PM
Thanks for help, maybe I got it

29 Jan 2013, 5:20 AM
One way of doing it that I've used is to submit ajax requests to a single page in charge of processing them. To be able to batch calls, I send a JSON string with an array of requests in it. The page processing ajax requests decodes the json and then runs all the calls requested. It then puts the results back in an array that gets encoded to JSON and returned. I have a utility function to make and receive those calls, allowing success/failure callbacks on both individual calls and the ajax request as a whole.

3 Oct 2014, 3:13 PM
do you have one example??tks