Reputation: 1520
Automatically reload page through ajax call in PHP. Code should be done at server side not in JS. Is it possible in PHP through ajax call?
Upvotes: 1
Views: 433
Reputation: 455
use this ajax request in javascript
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://yoursite.com/somefile.php?action=reload", true);
xhttp.send();
and this in php
if ( isset($_GET["action"]) && $_GET["action"] == "reload" ) {
header("Refresh:0");
}
Upvotes: 1