I need to do multiple XMLHttpRequest in short amount of time.
Before I used jquery and my code as the following and this worked well (I havent storring the results in any way):
function doStats(){
var postData....
$.ajax({
        url: url,
        type: 'post',
        data: postData,
        dataType: "json"
    }).done(function(response){
    
    }).fail(function(jqXHR, textStatus, errorThrown) {
   
    }); 
}
Now I have converted to javascript and if I call doStats multiple times in some short period, will this.responseText ensure my results are always correct and will creating xhrRequest_stat = new XMLHttpRequest(); not influence the one created before that?
function doStats(){
var params...
xhrRequest_stat = new XMLHttpRequest();
    xhrRequest_stat.onreadystatechange = function() {
        if (xhrRequest_stat.readyState == 4) {
            console.log(this.responseText)
        }
    }
    xhrRequest_stat.onerror = function(e) { 
        console.log('Error getStats: ' + e);
    };
    xhrRequest_stat.open('POST', url);
    xhrRequest_stat.setRequestHeader("Content-Type", 'application/x-www-form-urlencoded');
    xhrRequest_stat.send(params);
 }
Because I call this funtion sometimes few times sometimes not, there is no real order to it, so I cant really use for loop.
 
    