If I had a function like this:
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/
}
Will it be possible to set valid
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?