I can set javascript variables.. but can I retrieve them? if so. how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think what you really asking how you can retrieve client-side state, right? The process of “setting” a variable is actually downloading code into the browser which runs and has that side-effect. To get state back from the browser, be that Javascript variables or DOM element values, requires the opposite, i.e. to upload something.
What you most likely want is do XHR requests within your Javascript back to the server to transmit the required state. Make sense?