Possible Duplicate:
Persist javascript variables across pages?
how to exchange variables between two html pages
I am working on creating a "quiz" that allows users to answer questions, then passes their answer and current score to the next page for the next question. I used this article and was able to get the user's answer to pass through to the next window:
http://www.htmlgoodies.com/beyond/javascript/article.php/3471111/A-Quick-Tutorial-on-JavaScript-Variable-Passing.htm
The issue is that this passes the information through a form. Once I receive the score on the second page, I need to increment the score if the answer was correct. I can't figure out how to pass a javascript variable with an html form.
I feel like this should be a relatively easy fix, I'm just stumped.
Any thoughts or advice would be much appreciated! xoxo
There are two obvious ways to maintain state in the browser without requiring that the server remember it between pages:
Cookies
localStorage
The latter is trivial to implement, but is only available in HTML5.
Note that neither is intended to be secure - a determined page hacker could set either to whatever value they wish.
You can submit a form using get method <form method="get"
then use javascript to parse params in url. Reference here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With