1

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?

4
  • Reload the current document in php: location.reload(); Commented Sep 27, 2017 at 10:22
  • can you show what have you done so far? Commented Sep 27, 2017 at 10:27
  • learn about webhooks Commented Sep 27, 2017 at 10:30
  • Yes it is possible. We dont see what you have tried. You try we help Commented Sep 27, 2017 at 10:36

1 Answer 1

1

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");
 }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.