CodeIgniter Forums
Javascript only works on the home page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Javascript only works on the home page (/thread-43808.html)



Javascript only works on the home page - El Forum - 07-24-2011

[eluser]Unknown[/eluser]
Hello everybody,

Just wanted to stop by and ask if anybody has had this problem.

I'm setting up a site and for some weird reason javascript only works on the home page. I'm loading the views dinamically, like so:
Code:
$this->load->view('includes/header');
    
    $this->load->view($main_content);
    
    $this->load->view('includes/footer');

If I click on a link that takes me to http://localhost/site/index, javascript works just fine, but if from there I click a link that takes me to http://localhost/site/about, javascript does not work any longer.

I know the files are there because I'm only switching the view with the $main_content variable, and when I inspect the site in firebug everything seems to be there, loaded and available.

Also tried the
Code:
redirect('/site/about', 'refresh');
and it would just not work.

Any ideas?

Thanks


Javascript only works on the home page - El Forum - 07-24-2011

[eluser]InsiteFX[/eluser]
Take the / off of the begging!
Code:
redirect('site/about', 'refresh');

InsiteFX