title: jQuery PreventDefault not stop execution
body: <p>I should paste code first </p>
  
  <pre><code>$(document).ready(function(){
      $("#submit").click(function(e){                                    
          $(".error").hide();
          var hasError = false;
  
          .... ....
  
          var captcha = $("#captchacode").val();
          if(captcha == '') {
              $("#captchacode").after('&lt;span class="error"&gt;You forgot to enter security image.&lt;/span&gt;');
              hasError = true;
          } else {
  
              $.post("/checkcaptcha.php",
                  { captchac: captcha},
                      function(data){
  
                          if (data == "Invalid"){
                              $("#captchacode").after('&lt;span class="error"&gt;Invalid security text. Please try again&lt;/span&gt;');
                              hasError = true;
                              e.preventDefault();
                          }
                      }
              );
          }
  
  
          if(hasError == false) {
              $(this).hide();
              $("#sendEmail li.buttons").append('&lt;img src="images/loading.gif" alt="Loading" id="loading" /&gt;');
  
              $.post("/sendemail.php",
                  { emailFrom: emailFromVal, name: name, message: messageVal },
                      function(data){
                          $("#sendEmail").slideUp("normal", function() {                 
  
                              $("#sendEmail").before('&lt;h1&gt;Success&lt;/h1&gt;&lt;p&gt;Your email was sent.&lt;/p&gt;');                                          
                          });
                      }
                   );
          }
  
          return false;
      });                        
  });
  </code></pre>
  
  <p>Everything is working. Email is being sent. I'm getting error message while putting invalid captcha value. Just after showing error message, it's going in next step and form is submitting. I need your suggestion to fix that.</p>
  
  <p>Thanks.</p>