This should be simple, but doesn't work
Essentially I want to get a return result and reload my page if the answer is 'yes'
Here is the timer.php
<?php
$filename = 'timer.tmr';
if (file_exists($filename)) {
unlink($filename);
echo 'yes';
} else {
echo 'no';
}
?>
and here is the script in my main file
var myVar = setInterval(function () {myTimer()}, 5000);
function myTimer() {
sendto = "timer.php";
$.get(sendto, function(data, status) {
if (data === 'yes') {
location.reload();
}
});
}
Basically in the timer.php
If the file exists I delete it and return a 'yes'
But the jquery
doesn't do the reload function, if I check the data with an alert(data), it returns a 'yes' So I just don't understand the problem.