title: AJAX: sending xmlhttp requests in a loop
body: <p>I have this function below and I call that function in a loop I get the alert n times but only n-1 or sometimes n-2 responses</p>
  
  <pre><code>if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
      if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
      {
          alert(xmlhttp.responseText);
          //document.getElementById("warnings_panel").innerHTML+=xmlhttp.responseText;
      }
  }
  
  alert("in ajax) 
  
  xmlhttp.open("GET","getresponse.php?start="+ start + "&amp;end=" + end,true);
  xmlhttp.send();
  </code></pre>