Mudsaf Posted June 18, 2014 Share Posted June 18, 2014 Hello, i'm wondering is it possible to unset session before any JavaScript code starts running? Link to comment Share on other sites More sharing options...
Don Jajo Posted June 18, 2014 Share Posted June 18, 2014 then try this way <?phpif(session_destroy()) {echo '<script>alert("Session destroyed")</script>';}?> Link to comment Share on other sites More sharing options...
Mudsaf Posted June 18, 2014 Author Share Posted June 18, 2014 (edited) then try this way <?phpif(session_destroy()) {echo '<script>alert("Session destroyed")</script>';}?> I didin't want session to be destroyed, but i noticed the error somewhere else. Thx for your time tho ! Edited June 18, 2014 by Mudsaf Link to comment Share on other sites More sharing options...
thescientist Posted June 18, 2014 Share Posted June 18, 2014 PHP is server side. JS is client side. PHP executes first before any content gets sent to the browser. If you want to do something with $_SESSION before anything is done in the browser, do it in the PHP. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now