Use jQuery to dynamically change the GET target form on submission

I would like to submit a form, specifically an input field for a URL, based on the value of the input field using GET.

Example: the value of the " test " input field . Submit GETs www.myurl.com/Products/Search/ test

Example: the value of the input field is empty . Submit GETs www.myurl.com/Products/Search/

Example: The value of the input field is " 123 ". Submit GETs www.myurl.com/Products/Search/ 123

How can I do this using jQuery? Probably catch the serve .. ?? Thanks for the help!

+2


source to share


1 answer


$('form').submit(function() {
    this.action += $('#myInput').val();
    return true;
});

      



+2


source







All Articles