I am usign jason_encode in php_ajax file, but I am having error message in consol, "Ajax error: 200 parsererror", Can You please review my code ?? I have one index file that show the status message on runtime using ajax and jason, this is my ajax file that send the true and false to my index with error message if exist otherwise it show the ok message if each check goes good.
$validateValue=$_REQUEST['fieldValue'];
$validateId=$_REQUEST['fieldId'];
$emailaddress = $validateValue;
$validateError= "email is not correct";
$validateSuccess= "email is correct";
$arrayToJs = array(); // creating array
$arrayToJs[0] = $validateId;
$arrayToJs[1] = $validateId;
if($numrow > 0) // where $numrow is getting data from database.
//if($validateValue !=="raza@gmail.com") // this check can also be used
{ // validate??
for($x=0;$x<1000000;$x++){
if($x == 990000){
$arrayToJs[1] = false;
echo json_encode($arrayToJs); // RETURN ARRAY WITH ERROR
//return false;
}
}
}
else
{
$arrayToJs[1] = true; // RETURN TRUE
echo json_encode($arrayToJs); // RETURN ARRAY WITH success
## Check for the ggg mail
}
if($validateValue == "ggg@gmail.com")
//check the second check
{ // validate??
for($x=0;$x<1000000;$x++){
if($x == 990000){
$arrayToJs[2] = false;
echo json_encode($arrayToJs); // RETURN ARRAY WITH ERROR
//return false;
}
}
}
else
{
$arrayToJs[2] = true; // RETURN TRUE
echo json_encode($arrayToJs); // RETURN ARRAY WITH success
}