simultaneous-calls

How to handle Simultaneous javascript xmlhttprequests? [duplicate]

老子叫甜甜 提交于 2019-11-28 08:48:29
Possible Duplicate: passing index from for loop to ajax callback function (javascript) I've been a little confused with making xmlhttprequests, to different servers, in order to fetch some content.. Here is what I've written, but it seems that I'm mistaken at some point.. var URL = new Array(); URL[0] = "http://www.example1.com"; URL[1] = "http://www.example2.com"; URL[2] = "http://www.example3.com"; var nRequest = new Array(); for (var i=0; i<3; i++) { nRequest[i] = new XMLHttpRequest(); nRequest[i].open("GET", URL[i], true); nRequest[i].onreadystatechange = function (oEvent) { if (nRequest[i

How to handle Simultaneous javascript xmlhttprequests? [duplicate]

岁酱吖の 提交于 2019-11-27 02:26:11
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: passing index from for loop to ajax callback function (javascript) I've been a little confused with making xmlhttprequests, to different servers, in order to fetch some content.. Here is what I've written, but it seems that I'm mistaken at some point.. var URL = new Array(); URL[0] = "http://www.example1.com"; URL[1] = "http://www.example2.com"; URL[2] = "http://www.example3.com"; var nRequest = new Array(); for