How to Wait for Multiple Promises for All Data Success Callbacks

前端 未结 3 773
迷失自我
迷失自我 2021-01-26 10:26

I have this API call, but I don\'t receive the data in my successCallback in the same order as I send it.

    for (var i = 0; i < data.length; i+         


        
3条回答
  •  无人及你
    2021-01-26 10:44

    As Groben says, you could create an array of the promises for each request, and then you can use the "when" callback to execute when all are completed.

提交回复
热议问题