Javascript function returns undefined on firebug
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call-from-a-function">How to return the response from an AJAX call from a function?</a>  </p>
</blockquote>



<p>on my App namespace i've just defined a function:</p>

<p>version 1</p>

<pre><code>window.App = {
  isLogged: function () {
    $.get('/user/isLogged', function (data) {
      if (data == 'true') {
        return true;
      }
      return false;
    });
  }
};
</code></pre>

<p>version 2</p>

<pre><code>window.App = {
  isLogged: function () {
    var test = $.get('/user/isLogged');
    console.log(test.responseText);
  }
};
</code></pre>

<p>On version 1 when i try the function on firebug 'App.isLogged()' i got a nice undefined :S</p>

<p>On version 2 when i try the function on firebug, the responseText seems to be undefined :stuck:</p>

<p>I'm pretty new about javascript, and maybe a scope issue...</p>

<p>The goal of my function is clear i think, there's a better way to achieve this?</p>
