title: Submit button (Ajax) only works once
body: <p>Here's my simple HTML form &amp; JS:</p>
  
  <pre><code>&lt;body&gt;
      &lt;form&gt;
          &lt;label for="usrtext"&gt;Enter text here:&lt;/label&gt;
          &lt;br /&gt;
          &lt;textarea name="usrtext" id="usrtext" rows="25" cols="100"&gt;&lt;/textarea&gt;
          &lt;br /&gt;
          &lt;button id="btn" type="button"&gt;Send&lt;/button&gt;    
      &lt;/form&gt;
      &lt;script type="text/javascript"&gt;
          document.getElementById('btn').onclick = request;
  
          function request()
          {
              var xhr = new XMLHttpRequest();
  
              var usrtext = document.getElementById("usrtext").value;
  
              xhr.open("GET", "sampleb.php?usrtext="+usrtext, true);
  
              xhr.onreadystatechange = function(aEvt)
               {
                  if (xhr.readyState == 4)
                  {
                      if (xhr.status == 200)
                      {
                          var temptxt = document.body.innerHTML;
                          document.body.innerHTML = temptxt + xhr.responseText;
                      }
                  }
               }
  
              xhr.send('');
          }
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Here's the php page (sampleb.php):</p>
  
  <pre><code>&lt;?php
  
  if (isset($_REQUEST["usrtext"]))
  {
      $output = $_REQUEST["usrtext"];
  }
  
  echo $output;
  ?&gt;
  </code></pre>
  
  <p>The problem I'm having is that when you enter text into the text box and submit it, the php page gets the text and sends it back fine. BUT this only works the first time. If I enter new text into the textbox and click the submit button, the ajax call does not seem to work the second time. </p>
  
  <p>I'm fairly new at this, but I replaced 'request' with a console.log and if I click the button multiple times, it registers in Firebug. I also replaced 'request' with an annon function that brings up an alert box and that works on multiple button clicks... I just don't know why my 'request()' function is not being called a second time. </p>