I have a javascript function that calls a php to update DB data. After the data is updated in the DB I want to refresh the page, but I have to wait until the PHP functions finish running.
As you can see, I'm using setTimeout to reload the page after 6 seconds.
I wanted to know how to detect if the php finshed running without specifying a time window?
This is the JavaScript code:
function refresh() {
http.abort();
http.open("GET", "searchfiles.php");
http.send(null);
var timeoutID = window.setTimeout("location.reload(true);", 6000);
}