Global Variable vs Hidden Input TextBoxes

M

mouac01

Currently I'm using hidden input textboxes to store session variables
(eg. login_id, first_name, last_name). So when I need to use the
values in a fuction I would do login_id.value, etc.. I'm thinking if
it's better to just set the login_id, etc.. as global variables. I
may have a lot of variables and the session may be long. I'm worried
that I might lose global variables due to memory leaks and other
issues. In my mind if I store it in a hidden textbox the text
actually is stored on the page so it won't just disappear. Any
thoughts? Thanks...
 
S

SAM

(e-mail address removed) a écrit :
Currently I'm using hidden input textboxes to store session variables
(eg. login_id, first_name, last_name). So when I need to use the
values in a fuction I would do login_id.value, etc.. I'm thinking if
it's better to just set the login_id, etc.. as global variables. I
may have a lot of variables and the session may be long. I'm worried
that I might lose global variables due to memory leaks and other
issues. In my mind if I store it in a hidden textbox the text
actually is stored on the page so it won't just disappear. Any
thoughts? Thanks...

Really, JS global variables can disappear ?

Is there a difference between :
- to remember what is coded in the body (hidden values) of the page
- and to remember what is coded in the head (JS global variables)?

Now, if you need these hidden values, yes why not to use them instead to
work with their JS clones.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top