Multiple ajax request state? <p>I'm writing a script that need that executes some paralleled ajax requests. I'm using an ajax array but i want to execute some code(make some tags visible) when all the requests are complete. here's the code hope u can help me.</p> <pre><code>function Update_All(){ var loading = document.getElementById("loading_image"); var actualizacion_completa = document.getElementById("actualizacion_completa"); loading.style.display = ""; actualizacion_completa.style.display = "none"; var i=1; var ajax= new Array(20);//objetoAjax(); var limit = 1; var ready = 1; for (i=1;i&lt;=20;i++) { var index = i-1; ajax[index] = objetoAjax(); var voatencion = document.getElementById("idatencionf"+i); var vohoras = document.getElementById("vhorasf"+i); var vtarifa = document.getElementById("tarifaclientef"+i); var voexonerado = document.getElementById("vexoneradof"+i); var voaprobado = document.getElementById("vaprobadof"+i); var campo = document.getElementById("f"+i+"c1"); if(typeof(campo) != 'undefined' &amp;&amp; campo != null){ var valor = 1; if(campo.innerHTML=="Si") valor = 2; ajax[index].open("GET","update.php?atencion="+voatencion+"&amp;opc="+5+"&amp;valor="+valor+"&amp;exonerado="+voexonerado.value+"&amp;tarifa="+vtarifa.value+"&amp;horas="+vohoras.value); ajax[index].send(null); limit = i; ajax[index].onreadystatechange=function() { if (ajax[index].readyState==4 &amp;&amp; ajax[index].status == 200) { ready++; if(ready == limit){ loading.style.display = "none"; actualizacion_completa.style.display = ""; } } } } else{ break; } } } </code></pre> <p>the problem is ready never gets equal to limit.</p> <p>PS: srry about the spanish variable's names;</p>