Reputation: 91
I want to pass two inputs' values into url to make it like
"http://www.testing.com?item=product+amount=100"
It is just an example.
A lot of tutorials are passing values from url into fields of the form.
how to make it in a reverse way...
Thanks in advance.
P.S
There are two pages, one page has one form. Page One's form is filling by users, and then pass the values through url to Page Two's form, Page Two's form can grab the values from the url to fill up the relatively fields.
Thank you so much for you guys' reply.
Upvotes: 1
Views: 3175
Reputation: 324640
Erm...
<form action="" method="get">
<input type="text" name="item" value="product" />
<input type="text" name="amount" value="100" />
<input type="submit" />
</form>
When the submit button is clicked, the item
and amount
variables are "passed into the URL".
Upvotes: 3
Reputation: 150253
var data = $('input').serialize();
More specific can be:
var data = $('#item, #amount').serialize();
Then append the data to the querystring of the URL, or use one of jQuery ajax functions.
Upvotes: 3