I have x = 65; in a JavaScript page /var/html/pag1.js
and I want to pass x to a different page: /var/html/user1/pageUser.js
What’s the easiest way to send a value like that?
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.
Your question is a little unclear. In an attempt to decipher and give a good answer, I’ll restate your question. I believe you are trying to ‘post’ a field called ‘x’ with value of ’65’ to another page. You say you have a ‘page’ with name ‘page1.js’, but that is a script and not a page. You might have a ‘page1.html’ that references ‘page1.js’ (same for page2). I’ll proceed on the assumption you have 2 files:
Normally, data is passed between pages using form actions like this…
Page1.html:
If you want to do this using javascript, you can should look into jquery and it’s post() method. Here’s an example in context…
Page1.html: