title: Validation on form action when using preventDefault
body: <p>I'm making a ajax call to a server side function to send an email. It works fine. My issue is before sending the email i need to validate the captcha where the server side code resides in CaptchaValidation.php. If i call "CaptchaValidation.php" on form action it should work fine but here since i'm doing a ajax call i need to use e.preventDefault();. So that form action is not working.</p>
  
  <p>How can i make it work?</p>
  
  <p></p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
   &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $('#divLoading').hide();
              $('#appointment').submit(function (e) {
                  e.preventDefault();
  
  
  
                  var serviceURL = 'WebService.asmx/SendMail';
                  var Name = $("#fname").val();
                  var Email = $("#email").val();
                  var Telephone = $("#phone").val();
                  var Comment = $("#comment").val();
  
                  if ($("#fname").val().length == 0) {
                      alert("Please Enter Name");
                      $("#fname").focus();
                      return false;
                  }
  
                  if ($("#email").val().length == 0) {
                      alert("Please Enter Your Email Address.");
                      $("#email").focus();
                      return false;
                  }
  
                  if (Email.indexOf("@") == -1) {
                      alert("Please Enter Your Email Address.");
                      $("#email").focus();
                      return false;
                  }
                  if (Email.indexOf(".") == -1) {
                      alert("Please Enter Your Email Address.");
                      $("#email").focus();
                      return false;
                  }
  
                  $('#divLoading').show();
  
                  $.ajax({
                      type: "POST",
                      url: serviceURL,
                      data: '{"name":"' + Name + '","address":"' + Email + '","telephone":"' + Telephone + '","comment":"' + Comment + '"}',
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: successFunc,
                      error: errorFunc
                  });
  
                  function successFunc(data, status) {
  
                      //  alert("Mail Sent!");
                      $('#divLoading').hide();
                      window.location = "contat-submit.php";
  
                  }
  
                  function errorFunc() {
                      // alert('error');
                  }
  
              });
  
          });
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;form name="appointment" id="appointment" method="post" action="CaptchaValidation.php"&gt;
      &lt;div&gt;
      &lt;/div&gt;&lt;div id="leftcolumn4"&gt;&lt;div class="h2"&gt;Contact Form&lt;/div&gt;
        &lt;form name="appointment" id="Form1" method="post" action="send_contact.php"&gt;
  Full Name:
  &lt;br /&gt;
  &lt;label&gt;
    &lt;input name="fname" type="text" class="form-input" id="fname" size="30" /&gt;
  &lt;/label&gt; 
  &lt;br /&gt;&lt;br /&gt;
  
  Email Address:&lt;br /&gt;
  &lt;label&gt;
    &lt;input name="email" type="text" class="form-input" id="email" size="30" /&gt;
  &lt;/label&gt;&lt;br /&gt;&lt;br /&gt;
  Telephone:
  &lt;br /&gt;
  &lt;label&gt;
    &lt;input name="phone" type="text" class="form-input" id="phone" size="30" /&gt;
  &lt;/label&gt; 
  &lt;br /&gt;&lt;br /&gt;
  Your Comment:&lt;br /&gt;
  &lt;label&gt;
  &lt;textarea name="comment" cols="28" rows="4" class="form-input-box" id="comment"&gt;&lt;/textarea&gt;&lt;br /&gt;
  
        &lt;br /&gt;
  &amp;nbsp;&lt;/label&gt;&lt;input name="submit" type="submit" class="form-input-submit" value="Submit" id="btnMail"/&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>