title: Can't set an variable in jquery getjson function?
body: <p>I want to set an variable in the function after i send an ajax request.
  What is the reason why the function alert outside the getjson function undefined and inside the good value? Is there some solution?</p>
  
  <pre><code>function gettextlabel(txtvar){ 
      var v = '';
      $.getJSON('http://192.168.0.92/visuals/support/text_handler.php?txtvar=' + txtvar , function(data) {
          v = data;
          alert(v);
      });
      alert(v);
  }
  </code></pre>