here is the problem.
i have HTML Form and it has a button submit with an onclick=validationFunction(). When i click this button, values from form goes to this function.
Now, in this function, the values of the form are cheenter code herecked ifenter code here they are correct or not. In addition, it has 1 input Field who has to be checked for validation, and also checked again from database to see it that value exists there. This part is done via ajax. Below the ajax call, there is a return value(boolen) for the function validationFucntion().
Now, what i want. i want either of the two things.
1) ajax should return true or false within its success
2) or ajax should send the value just below where the ajax call ends. By now, i m failing big times to do either of the things.
Here is a sample pseudo code.
    function validationFunction()
{
     validations checks in progress
     $.ajax({
     url:'checkIfNumberExists.php',
     data : {
             'number : num //this num is coming from above
            },
     method:'GET',
     success: function(data)
            {
                console.log("Return Value = "+this.toReturn);
                if(  (this.toReturn) > 0 )
                {
                     either return validationFunction from here or set a flag.
                }
                else
                {
                     either return validationFunction from here or set a flag.
                }
     });
}
checkIfNumberExists.php
<?php
$num = $_GET['number'];
$toReturn = 0 ;
$queryCheckNo = mysql_query('SELECT * FROM `TABLE` WHERE `number_from_table`="'.$num.'" ');
while($row = mysql_fetch_assoc($queryCheckNo)){
    $toReturn++;
}
echo ($toReturn);
?>
 
    