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