title: Store ajax result in jQuery variable
body: <p>I started using jQuery and ajax to get data from database, but i cant find out how i can save result of $.get() into variable outside callback function.</p>
  
  <p>This is my jquery script:</p>
  
  <pre><code>var result="";     
  $.get("test.php", function(data){ result=data; });
  alert(result);
  </code></pre>
  
  <p>This is test.php script:</p>
  
  <pre><code>echo "Hello, World";
  </code></pre>
  
  <p>Every time i run this script it alerts "".</p>