Loop for asynchronous XMLHttpRequest requests:
- I generate the random callback name, which will be returned in response.
- I do xhr.open for XMLHttpRequest, where the newly generated callback is substituted in the url.
- The reply comes with the newly generated MyRandomCallback({"field": [{"id": "9283657325", .....}]});
- It is necessary to extract data from the reply with my randomly generated callback.
Example:
var f = (function(){
var xhr = [], i;
for(i = 1; i <= 100; i++){
    (function(i){
        xhr = new XMLHttpRequest();
        var callback = "jQuery"+getRandomStr(1000000,9999999); // getRandomStr - my function and it works well.
        xhr.open("GET", "https://example.com/1.html?callback="+callback, true);
        xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            console.log(WHAT????);
        }
    })(i);
}
})();
How to get '9283657325'?
 
    