I have two HTML pages, example1.html and example2.html.
How do I pass variables from example1.html to example2.html using the query string, and retrieve that variable in example2.html without using any serverside code?
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.
In example1.html:
or generate the links with Javascript as desired. Just make sure the ?varName=value gets onto the end of example2.html somehow.
Then, in example2.html, you use Javascript to parse the query string that example2 came with.
To do this, you could try Querystring.
Alternatively, parent.document.URL contains the complete URI for the page you’re on. You could extract that:
and parse it manually to pull the variables you encoded into the URI.
EDIT: Forgot the ‘new’ part of ‘new Querystring()’. Oops…