Javascript variable scoping question
<p>If I had a function like this:</p>

<pre><code>function validateSomething()
{
  var valid;
  $.post("something.php", {x:y},
  function(data)
  {
     if (isSomething(data))
       valid=true; 
       //Here referring to the valid variable 
       //set outside this function, in the
       // parent function
     else
       valid=false; 
  });
  return valid/
}
</code></pre>

<p>Will it be possible to set <code>valid</code> from within the child function which is called after the Ajax request completes? If not, how can I return true/false from the parent function based on the result of the ajax request?</p>
