Hello Everybody,
Please see picture first to get a visual perspective of the problem. As you can see something is passed along the PHP script, circled in red. what ever is within the circle is causing issues with my code but I can not seem to isolate where the circle value is coming from.
I have the relevant parts of the codes below.
Any help would be greatly appreciated.
Javascript code. Only copy/pasted the relevant part of the code to keep this short.
if(xhr.readyState === 4 && xhr.status === 200) {
if(xhr.responseText === 'found') {
console.log("Found - Data saved!!!" + xhr.responseText);
} else {
console.log("failed to save data =>: " + xhr.responseText);
}
}
PHP code. The code works. Only copy/pasted the relevant part of the code to keep this short. This code sends the “found” or "not found to the javascript.
$result = $query->fetch(PDO::FETCH_ASSOC);
if(!$result) {
echo json_encode('not found');
} else {
echo json_encode('found');
}
}
}
?>