title: Return False not working inside jQuery.ajax
body: <p><strong>P.S.: Read "EDITED on 2019-06-29":</strong></p>
  
  <p>I have a webform for updating user information, and when he updates his email a verification is performed via <code>ajax()</code> so that he is warned if the new email address is already in use by another user.</p>
  
  <p>I'm trying to cancel the form submission when the email is in use, but <code>return false;</code> doesn't work.</p>
  
  <p>Any other <code>return false;</code> within if statements are working fine, the problem is only with this one inside the <code>jQuery.ajax()</code> call.</p>
  
  <p>Here's the actual code:</p>
  
  <pre><code>var email = jQuery('#email').val();
  jQuery.ajax({
      type : 'GET',
      url : '/ajax/verify-email.php?email=' + email,
      success : function( d ) {
          if( d == '1' ) {
              alert('Another user is using this email');
              jQuery('input[name="email"]').focus();
              return false; // this guy over here is not working!!!!
          }
      }
  });
  </code></pre>
  
  <p>Does anyone have a solution?</p>
  
  <p><strong>EDITED on 2019-06-29</strong></p>
  
  <p>When I asked this question back in 2012 I wasn't aware of Promises in Javascript, neither knew about "$.when" (even though added 3 years later of this question) to handle asynchronous requests alongside $.ajax.</p>
  
  <p>Today, you can handle the same scenario easily, as this:</p>
  
  <pre><code>let email = $('#email').val();
  $.when(
    $.ajax({
      type : 'GET',
      url : `/ajax/verify-email.php?email=${email}` 
    })
   .then(function(d) {
     alert('Another user is using this email');
     $('input[name="email"]').focus();
  });
  // your code continues from here as desired...
  </code></pre>