title: xmlHttpRequest readyState stuck at 1
body: <p>I have a simple ajax code (i"m trying to check if an xml file has changed before I update my site) but for some reason the readystate get stuck at 1 and the onReadyStateChanged event handler does not fire.</p>
  
  <p>here is my javascript</p>
  
  <pre><code> window.setInterval(updateCount, 1000);
      var xmlhttp = init();
  
      function updateCount() {
          i = document.getElementById("updater")
          if (i.value != "") {
              if (xmlhttp.readyState == 4 || xmlhttp.readyState == 0) {
                  xmlhttp.onreadystatechange = update_chacker;
                  xmlhttp.open("GET", i.value, true);
                  xmlhttp.send;
              }
          }
      }
  
      function init() {
              if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                  return new XMLHttpRequest();
              }
              else {// code for IE6, IE5
                  return new ActiveXObject("Microsoft.XMLHTTP");
              }
          }
  
      function update_chacker() {
  
          var txt, x, xx, i;
          console.log("readystate = " + xmlhttp.readyState);
          if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
              xx = document.getElementById("MessagesBulletedList");
              x = xmlhttp.responseXML.documentElement.getElementsByTagName("Message");
              if (x.length &gt; xx.getElementByTagName('li').length) {
                  var clickButton = document.getElementById("updater");
                  clickButton.click();
              }
          }
      }
  </code></pre>
  
  <p>HTML (less important but if you want to understand the references here it is)</p>
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
      &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" width="300px" UpdateMode="Always" OnLoad="UpdatePanel1_Load" ViewStateMode="Enabled"&gt;
          &lt;ContentTemplate&gt;
              &lt;asp:PlaceHolder ID="ph" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
  
              &lt;br /&gt;
              &lt;asp:Label ID="chatterLbl" runat="server" /&gt;
              &lt;br /&gt;
              &lt;div id="ChatText" style="width: 640px; height: 240px; overflow: auto;"&gt;
                  &lt;asp:BulletedList ID="MessagesBulletedList" runat="server" /&gt;
              &lt;/div&gt;
          &lt;/ContentTemplate&gt;
          &lt;Triggers&gt;
              &lt;asp:AsyncPostBackTrigger ControlID="SendButton" EventName="Click" /&gt;
              &lt;asp:AsyncPostBackTrigger ControlID="updater" EventName="Click" /&gt;
          &lt;/Triggers&gt;
      &lt;/asp:UpdatePanel&gt;
  
  
      &lt;div hidden="hidden"&gt; &lt;asp:Button ID="updater" runat="server" Text="" /&gt; &lt;/div&gt;
      &lt;br /&gt;
      &lt;asp:UpdatePanel ID="UpdatePanelTextBox" runat="server" UpdateMode="Conditional"&gt;
          &lt;ContentTemplate&gt;
              &lt;asp:TextBox ID="NewMessageTextBox" Columns="50" runat="server" /&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
      &lt;asp:Button ID="SendButton" Text="Send" runat="server" OnClick="SendButton_Click" /&gt;
  </code></pre>