CodeIgniter Forums
trying to refresh browser - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: trying to refresh browser (/showthread.php?tid=78387)



trying to refresh browser - richb201 - 01-12-2021

I am trying to refresh a web page after making some changes. 

header("refresh: 3");

This line seems to have no affect. But when I press the refresh icon in the browser it works perfectly. Why? 


RE: trying to refresh browser - php_rocs - 01-12-2021

@richb201,

How are you updating the page? PHP or Javascript?


RE: trying to refresh browser - richb201 - 01-12-2021

PHP I think. I am using Grocery Crud.


RE: trying to refresh browser - php_rocs - 01-12-2021

@richb201,

Have you tried reaching out to the Grocery CRUD community?


RE: trying to refresh browser - demyr - 01-12-2021

If your request is PHP then, when the process is success you can redirect to the same page :

PHP Code:
$result $this->UserModel->save($data);
if(
$result){
return 
redirect()->to($_SERVER['HTTP_REFERER']);



If it is an ajax request:
Code:
window.setTimeout(function(){location.reload()},1500)



RE: trying to refresh browser - InsiteFX - 01-12-2021

PHP Code:
$url=$_SERVER['REQUEST_URI'];
header("Refresh: 10; URL=$url"); 



RE: trying to refresh browser - richb201 - 01-12-2021

(01-12-2021, 09:55 AM)demyr Wrote: If your request is PHP then, when the process is success you can redirect to the same page :

PHP Code:
$result $this->UserModel->save($data);
if(
$result){
return 
redirect()->to($_SERVER['HTTP_REFERER']);



If it is an ajax request:
Code:
window.setTimeout(function(){location.reload()},1500)
Thanks. I have lots of custom data in session variables. Is this an issue? With the ajax version can I place that in the middle of my php code?