My problem is very simple. I have a javascript that updates an html page everytime it gets a new ajax request. Here is the fetched php:
if (isset($_REQUEST['sowhat'])) {
$file="hello.txt";
while( !file_exists($file) ) {
sleep(1);
}
unlink($file);
$RESPONSE="ok";
echo json_encode($RESPONSE);
}
I need the javascript to send a query again every time it gets an ok response from the php. How is this achievable? I have tried with a basic infinite loop but the page crashes.
$.when($.ajax( "json_test.php?sowhat="+"kkk" )).done(function(result){
console.log(result);
console.log('done');
thisone.parent().hide("slide", { direction: "left" }, 500)
thisone.parent().prev().show("slide", { direction: "right" }, 500)
// AJAX AGAIN, FOREVER
});
Any help is greatly appreciated, thanks in advance.