Reputation: 5866
I am trying to send value of < input type="text"> to the URL without the key, which is < input name="q">
With the below code, the calls "http://localhost/Products/?q=XXXX". Instead, I want to see "http://localhost/Products/XXXXX"
<form method="get" class="search" action="/Products/">
<input name="q" type="text" placeholder="Please enter the name of the product that you want to find">
<button type="submit" aria-label="Search"><i class="header-icon_search_custom"></i></button>
</form>
How can I achieve the URL that I described above?
Upvotes: 0
Views: 230
Reputation: 2054
You can't do it by just using the default submit behavior. According https://www.w3.org GET
-
With the HTTP "get" method, the form data set is appended to the URI specified by the action attribute (with a question-mark ("?") as separator) and this new URI is sent to the processing agent.
You can can use JavaScript over the form submit to get the desired request like: http://localhost/Products/XXXXX
Upvotes: 1