jQuery submit form calls a function with ajax
<pre><code>jQuery(document).ready(function(jQuery) {
    function checkEmail(email){
         jQuery.post('someroute.php',
              {email:eamil},
                  function(data){
                                         if(data==error){
                                                return false;
                                         }
              );
      return true;
}

jQuery('#myform').submit(function(){
// como code and at the momment this
var result true;
//then I check email
var email = ('#myemail').val();
result =  checkEmail(email);
return result;
});
</code></pre>

<p>The problem is this, a <code>checkEmail</code> function, first return true, and then return value <code>jQuery.post</code> function. Why?</p>

<p>I checked and in submit, first return true, and if you stop submit then you release that post return the value. Post works fine, but I don't understand why function <code>checkEmail</code> does not wait until post returns the value and goes on until the end to return true.</p>
