View Full Version : Get values from prompt and textbox in javascript. Problem.

09-20-2011, 08:22 AM
1) How can i get values from one page to another in javscript? Like, in php we use post and $_Post methods to move the values from one page to another. In the same way how can i move data between two pages in javascript?

2) How can i get the value of prompt on another page? E.g.,
prompt("What is your name?", "");

Now, i want to get the value(i.e. answer of the question "What is your name?") and get that value to another page. How can i do this?

Any help is greatly appreciated.

09-20-2011, 08:33 AM
The only easy way i know is:


<script type="text/javascript">
var name = prompt("What is your name", "Type you name here");

window.location = "page2.php?name"+name;


<script type="text/javascript">
alert("<?php echo $_GET['name']; ?>");

09-20-2011, 08:41 AM
Thanks a lot wanna. It's very useful for me.:thumbsup: