简体   繁体   中英

Server side code to reload page through jQuery ajax call in PHP

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?

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");
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM