title: ajax function returning undefined
body: <p>I have a function to validate a code with AJAX(PHP). However, when I try to run it, it returns <code>undefined</code> when it should return <code>true</code> or <code>false</code>.</p>
  
  <p>function:</p>
  
  <pre><code>function verifyViite(viite) {
      $.get('dataminer.php?question=validateViite&amp;q='+viite, function(data) {
          jQuery.globalEval(data);
          if(valid == 1) {
              return true;
          }
          else {
              return false;
          }
      });
  }
  </code></pre>
  
  <p>The <code>data</code> is either <code>valid = 1;</code> or <code>valid = 0;</code></p>