title: How to stop XMLHTTP from clashing with each other?
body: <p>I have two AJAX scripts, with xmlhttp requests.
  But they're clashing with each other, for example AJAX function 2 will display function 1's xmlhttp.response. I was wondering if there's a way to stop this? I already tried adding xmlhttp.close but that didn't work.
  Thanks in advance!</p>
  
  <pre><code>&lt;script&gt;var hello = setInterval(function()
  {
  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)
      {
      document.getElementById("main").innerHTML=xmlhttp.responseText;
      xmlhttp.close;
      }
    }
  xmlhttp.open("GET","ajax.php?user=" +username,true);
  xmlhttp.send();
  }, 1000);
  &lt;/script&gt;
  
   &lt;script&gt;var anotherone = setInterval(function()
  {
  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)
      {
      document.getElementById("sub").innerHTML=xmlhttp.responseText;
      xmlhttp.close;
      }
    }
  xmlhttp.open("GET","ajax.php?user=" +username +"&amp;do=" +option,true);
  xmlhttp.send();
  }, 1000);
  &lt;/script&gt;
  </code></pre>