How to process several asynchronous http requests at once
Can I do the following without my program crashing?
- var urlArray = // several URLs
- for(var i = 0; i < urlArray.length; i++) {
- jQuery.get(urlArray[i], function (data) {
- // do something with data
- }
- }
I have created an application that does something similar to the code I just posted. However, my program crashes intermittently. Sometimes it will crash after calling jQuery.get() a few times (with several http requests still pending). Other times it will get through all of them just fine.
I want to know if Ajax can handle that many asynchronous requests without crashing? Can someone look at this to see if there is something I am missing? I've looked online for help, but I didn't find anything about this problem. Thanks.