phpcodeigniterhttp-redirectcodeigniter-2reload

How do I fully refresh the page in CodeIgniter?


I am loading a form in an overlay. The overlay has a separate controller and action to the page that invokes the overlay.

On form submit, if successful, I simply want to reload the referring page that the overlay was loaded from. I can get the referring page to load, but it places the content inside the overlay.

header("Location: www.example.com", true, 302);

does not work.

Using the URL helper like this:

$url = $_SERVER['HTTP_REFERER'];
redirect($url);

Also does not work. Every time it loads in the overlay. I am sad because of it.


Solution

  • Unfortunately, using header to refresh/redirect will only reflect the changes in the container that is displaying the PHP page.

    To refresh the parent page (i.e. the page that is displaying the overlay itself), you will need to do it on the client-side using Javascript. These questions should help you get on the right path: