title: Uncaught Error: InvalidStateError: DOM Exception 11 with AJAX?
body: <p>I'm running a simple AJAX request: </p>
  
  <pre><code>function makePages(num) {
  
      var conn = new XMLHttpRequest();
  
      conn.onreadystatechange = function() {
          if (conn.status === 200 &amp;&amp; conn.readyState === 4) {  //error here
              $('#oldPost').before(conn.responseText);
          }
          else{
              return
          }
      }
  
      conn.open('GET','includes/feedExtra.php?num=' + num);
      conn.send();
  }
  </code></pre>
  
  <p>The code runs correctly and the PHP returns the correct content. However, there is an error in Chrome's console:</p>
  
  <blockquote>
    <p>Uncaught Error: InvalidStateError: DOM Exception 11</p>
  </blockquote>
  
  <p>it points to this line:</p>
  
  <blockquote>
    <p>if (conn.status === 200 &amp;&amp; conn.readyState === 4) {</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>