title: javascript function return not working
body: <p>I have a problem returning a variable in my function, the below script works fine:</p>
  
  <pre><code>function sessionStatus(){
      $(document).ready(function(){
          $.getJSON(scriptRoot+"sessionStatus.php",function(status){
              alert(status);
          });
      });
  }
  
  sessionStatus();
  </code></pre>
  
  <p>Bet when I try the following I get a message box with the message "undefined":</p>
  
  <pre><code>function sessionStatus(){
      $(document).ready(function(){
          $.getJSON(scriptRoot+"sessionStatus.php",function(status){
              return status;
          });
      });
  }
  alert(sessionStatus());
  </code></pre>
  
  <p>This is really bugging me, I just can't seem to see what I've done wrong.</p>