![]() |
AJAX logout problem - how to restrict some areas? - 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: AJAX logout problem - how to restrict some areas? (/showthread.php?tid=46882) |
AJAX logout problem - how to restrict some areas? - El Forum - 11-18-2011 [eluser]boltsabre[/eluser] Hi guys, just wanting some input on the best way to handle this. I've got a top nav bar login/out box, and it's all working just fine with JS disabled (aka no ajax), but I'm now building it in and run into a little problem... my ajax return logs out as expected, but some parts of my site are restricted and users must be logged in to view these areas... any ideas on how to work this functionality in??? Ah, just to clarify, if the user clicks 'logout' when they are inside a restricted method (like 'post_to_forum') I want them to be redirected to the login page. My controller (login.php) function, logout Code: function logout(){ And my ajax logout call (located in my global JS file) Code: $('#logout').click(function(e){ As you can see, I have a whole controller/area which is restricted, the 'user' controller (my profile, my ads, etc), and I've managed to handle this okay, but I have many other methods that are restricted unless logged in (post on forum, reply to forum, report forum thread, user reviews for this, that, and the next thing, etc). Sorry in advance if this is a simple thing, but Im more a server side guy that client side. Many thanks in advance! |