1

I need to erase a certain session variable from a javascript function how can i do this?

3
  • Can you give more details and maybe a code sample? Commented Mar 3, 2009 at 8:50
  • Wow. There really should be a [php-and-js-again] tag Commented Mar 3, 2009 at 9:03
  • $_session['cont_no']="smth"; i need to empty this session variable from a javascript function like "<script> function remove() { remove the session value } </script>" can this be done Commented Mar 3, 2009 at 9:21

2 Answers 2

1

I don't think this is possible. Sessions live on the server (not strictly true I know, but for the purposes of this answer, it's true enough).

I would write a script (PHP or somesuch) that unsets the session variable and fire off an ajax call to it.

Sign up to request clarification or add additional context in comments.

Comments

0

You would need to use an Ajax call to the server to access/delete the session variable as sessions are controlled/handled only on the server side, not the client side.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.