How to perform Ajax requests, a few at a time

后端 未结 3 723
余生分开走
余生分开走 2020-12-19 06:02

I am not really sure it is possible in JavaScript, so I thought I\'d ask. :)

Say we have 100 requests to be done and want to speed things up.

What I was thin

3条回答
  •  眼角桃花
    2020-12-19 06:23

    Yes, I have done something similar to this before. The basic process is:

    1. Create a stack to store your jobs (requests, in this case).
    2. Start out by executing 3 or 4 of the requests.
    3. In the callback of the request, pop the next job out of the stack and execute it (giving it the same callback).

提交回复
热议问题