title: Form Submission without page refresh
body: <p>Maybe someone can assist me with this little issue I'm having. I'm trying to submit this form without a page refresh.  But it will skip the post and go directly to the ajax call.  I think I miss understood the preventDefault(). I have searched online but unable to locate what I need for this. Your help would greatly be appreciated or point to another form submission.</p>
  
  <p>HTML below: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
   &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;AJAX | Project&lt;/title&gt;
   &lt;link href="project.css" rel="stylesheet"/&gt;
   &lt;script src="jquery.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
   &lt;body&gt;
  
  
  &lt;div id="mainCon"&gt;
  
    &lt;h1&gt;Contact Book&lt;/h1&gt;
  &lt;div id="form_input"&gt;
  &lt;form id="myform" method="post"    action="addrecord.php"&gt;
  
      &lt;label for="fullname"&gt;Name:&lt;/label&gt;
      &lt;input type="text" name="fullname" id="fullname"/&gt;&lt;span id="NameError"&gt;   &lt;/span&gt;
      &lt;br/&gt;
      &lt;label for="phonenumber"&gt;Phone Number:&lt;/label&gt;
      &lt;input type="text" id="phonenumber" name="phonenumber"&gt;&lt;span   id="PhoneError"&gt;&lt;/span&gt;
  
      &lt;br /&gt;
  
  &lt;input id="buttton" type="submit" onClick="addnumber()" value="Add Phone   Number"/&gt;
      &lt;input type="button" id="show" value="the Results"/&gt;
   &lt;/form&gt;
  
  
  &lt;/div&gt;
  
      &lt;div id="form_output"&gt;
  
  
      &lt;/div&gt;
  
  
  &lt;/div&gt;
   &lt;script src="project.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
  
   function addnumber(){
  
   var Fullname = document.getElementById("fullname").value;
  var Phonenumber = document.getElementById("phonenumber").value;
  
  
  
   if(Fullname == ""){
  document.getElementById("NameError").innerHTML = "Please Enter a valided Name";
  }
  
  if(Phonenumber == ""){
  document.getElementById("PhoneError").innerHTML = "Please Enter a valided Name";
  }
  
  }
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>$("document").ready(function () {
      $("#buttton").click(function () {
          $('#myform').submit(function (e) {
              e.preventDefault();
              $.ajax({
                  url: "listrecord.php",
                  type: "GET",
                  data: "data",
                  success: function (data) {
                      $("#form_output").html(data);
                  },
                  error: function (jXHR, textStatus, errorThrown) {
                      alert(errorThrown);
                  }
              }); // AJAX Get Jquery statment
          });
      }); // Click effect     
  }); //Begin of Jquery Statement 
  </code></pre>