Results 1 to 5 of 5

Thread: How to group multiple Ajax requests into a single batch request?

  1. #1
    Sencha Premium User
    Join Date
    Aug 2012
    Posts
    70

    Default Answered: How to group multiple Ajax requests into a single batch request?

    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?

    Thanks!

  2. 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.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    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.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha Premium User
    Join Date
    Aug 2012
    Posts
    70

    Default

    Thanks for help, maybe I got it

  5. #4
    Sencha Premium User
    Join Date
    Sep 2007
    Posts
    150
    Answers
    10

    Default

    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.

  6. #5
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    584
    Answers
    3

    Default

    do you have one example??tks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •