Reputation: 77329
I would like to submit a form, specifically an input field to a URL based on the input field's value using GET.
Example: Input field value is "test". Submit GETs www.myurl.com/Products/Search/test
Example: Input field value is empty. Submit GETs www.myurl.com/Products/Search/
Example: Input field value is "123". Submit GETs www.myurl.com/Products/Search/123
How could I do this using jQuery? Probably intercepting the submit..?? Thank you for your help!
Upvotes: 2
Views: 1394
Reputation: 1038730
$('form').submit(function() {
this.action += $('#myInput').val();
return true;
});
Upvotes: 2