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?
Thanks.
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?
Thanks.
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:
<body>
<form action='page2.html' method='post'>
<input type='text' name='x' value='65' />
<input type='submit' />
</form>
</body>
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:
<body>
<script type='text/javascript'>
$.ajax({
type: 'POST',
url: 'page2.html',
data: { x : 65 },
});
</script>
</body>