title: JavaScript: Global variables after Ajax requests
body: <p>the question is fairly simple and technical:</p>
  
  <pre><code>var it_works = false;
  
  $.post("some_file.php", '', function(data) {
  
       it_works = true;
  
  });
  
  alert(it_works); # false (yes, that 'alert' has to be here and not inside $.post itself)
  </code></pre>
  
  <p>What I want to achieve is:</p>
  
  <pre><code>alert(it_works); # true
  </code></pre>
  
  <p>Is there a way to do that? If not can <code>$.post()</code> return a value to be applied to <code>it_works</code>?</p>