CodeIgniter Forums
Setting session variable by clicking on "toggle" - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Setting session variable by clicking on "toggle" (/showthread.php?tid=33703)



Setting session variable by clicking on "toggle" - El Forum - 09-05-2010

[eluser]aaronr[/eluser]
I'm setting up a little portfolio of some of my work. I have a big graphic (in a div) on every page, it calls in a random image on each page. I also have a jquery hide/show toggle to hide the big graphic.

All of that is working. What I want to do is if someone clicks on "hide" and goes to another page (which causes a page reload of course) I want that big graphic (in a div) to stay hidden.

Can someone send me in the right direction to how to set a session variable via jquery (or regular .js)?

Thanks


Setting session variable by clicking on "toggle" - El Forum - 09-05-2010

[eluser]Buso[/eluser]
you need to use ajax

just create a controller/method pair (or use an existing controller) that does the saving, and call it with an ajax request http://api.jquery.com/jQuery.post/