title: AJAX form only reloads the page
body: <p>I've looked up various explanations for using ajax with forms, and have stripped the entire program down to just getting the form to talk with the php, but it's being unreasonably stubborn...</p>
  
  <p>The form:</p>
  
  <pre><code>&lt;form method="get" action=""&gt;
  Name:&lt;input type="text" name="uname" id="uname"&gt;&lt;br&gt;';
  &lt;input type="submit" onclick="addcomment()" value="Post"&gt;
  &lt;/form&gt; 
  &lt;a href="" onclick="addcomment()"&gt;Test&lt;/a&gt;
  </code></pre>
  
  <p>The javascript:</p>
  
  <pre><code>function addcomment()
      {
  
           if (window.XMLHttpRequest)
                  { xmlhttp=new XMLHttpRequest();}
              else
                  { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
  
              xmlhttp.onreadystatechange=function()
              {
                  if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
                  {
                      document.write(xmlhttp.responseText);
                      }
                     }
          xmlhttp.open("GET","test.php",true);
          xmlhttp.send();
      }
  </code></pre>
  
  <p>The PHP:</p>
  
  <pre><code>&lt;?php
  echo 'test';
  ?&gt;
  </code></pre>
  
  <p>It doesn't pass any information, and should only write 'test' across the screen, but instead, it reloads the html page, adding on the <code>'get'</code> <code>information(test.html?uname=)</code>. This works fine from an anchor tag, unless I try it after trying the form(ie, with the <code>'get'</code> information added to the page name). I'm sure I'm missing something basic. Can you help me?</p>
  
  <p>Thank you.</p>
  
  <p>P.S. I can't use jquery.</p>