CodeIgniter Forums
controller redirects to same page and creates a page inside a page - 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: controller redirects to same page and creates a page inside a page (/showthread.php?tid=72936)



controller redirects to same page and creates a page inside a page - viprit - 03-04-2019

Hi!
I'm having a strange issue. My page is essentially several forms on the same page but when one form is completed and I do everything I need on the backend, I use redirect(base_url('dashboard')) but it creates the same page on top of the page that was already there. So If I scroll down, I can see the same page (although broken because of javascript stuff) Speed Test Scrabble Word Finder Solitaire


Has anyone dealt with this issue? I've never done a single page site before. I appreciate any feedback! let me know if you want to see the code.


RE: controller redirects to same page and creates a page inside a page - ubayedtanvir - 03-04-2019

Redirecting will return a html page as a response but all you need to do is to validate the form data and do other stuffs as needed, then get a json response from the server instead of redirecting and show/hide forms based on the response you are getting.