Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  17] [ 7]  / answers: 1 / hits: 41277  / 13 Years ago, thu, april 28, 2011, 12:00:00

Is it possible to create and update a session variable in JavaScript? Just like in PHP as I start sessions and initialize session variable.



I'm using some JavaScript function with PHP.



I'm just a beginner in JavaScript so please also refer me some good books.


More From » javascript

 Answers
16

The usual meaning of the term Session variable is: Some data stored on the server, which is associated with a user's session via a token.



Assuming you are talking about client side JavaScript, then the short answer is no as it runs on the wrong computer.



You could use JS to make an HTTP request to the server, and have a server side programme store data in a session variable.



You could also use JS to store data in a cookie (and not set an expiry time so it expires at the end of the browser session)


[#92503] Wednesday, April 27, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaitlynnb

Total Points: 402
Total Questions: 96
Total Answers: 109

Location: Trinidad and Tobago
Member since Fri, May 8, 2020
4 Years ago
;