title: jQuery get function to return true/false
body: <pre><code>$(document).ready(function(){
   //global vars
   var name = $("#username");
      var email = $("#email");
  
  
   function usernameExists() {
    $.get("register.php",{ check: 1, username: name.val(), email: email.val() } ,function(m) {
        if(m==1) {
       return false;
      } else { 
       return true;
      }
    });
   }
  });
  </code></pre>
  
  <p>Firebug shows the right response when this function is being called, however it returns nothing...(this $.get(...) function has been tested outside the function usernameExists() but without the returns and it worked perfectly).</p>
  
  <p>What's the problem and how to solve?</p>
  
  <hr>
  
  <pre><code>     $(document).ready(function(){
      //global vars
      var form = $("#register");
      var name = $("#username");
      var email = $("#email");
  
       $.get("register.php",
               { check: 1, username: name.val(), email: email.val() },
  
                 // Have this callback take care of the rest of the submit()
               function(m) {
                  if(m==1) {
                       form.submit(function(){ return false; });
                  } else {
                      form.submit(function(){
          if(validateName() &amp; validateEmail() &amp; validatePass1() &amp; validatePass2())
              return true
          else
              return false;
                  });
               }
  
           }
        );
  
  function validateName(){
          // some check here
      }
  
  // and other functions
  
  });
  </code></pre>