I'm trying to make "many" xhr request but it seems that every time it waits for the answer before making another request. It's like XHR makes a queue and always wait for the previous request to finish.
What can I do to run more simultaneous xhr request?
$('body').delegate('.download','click', function(evt){
evt.preventDefault(); // Not related
var xhr = new XMLHttpRequest();
xhr.open('GET', "proxy.php?" + this.href, true);
xhr.responseType = 'blob';
xhr.onload = function() {
if (this.status == 200) {
var blob = new Blob([this.response], {type:'audio/mp4'});
console.log(blob.size);
if(blob.size > 0){
$("<a>").attr({
download: name,
href: URL.createObjectURL(blob),
target: "_blank"
})[0].click();
}
}
};
xhr.send();
});