N
N
nastya_zholudeva2018-03-15 12:38:46
JavaScript
nastya_zholudeva, 2018-03-15 12:38:46

How to generate a URL that adds the value of the search field on the site?

there is a page localhost:8080/search, how to make it so that when you enter text on it in the search bar, this text will be displayed in the url. In fact, so that you can throw a link to a person and he was sent to a page with search results

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
frees2, 2018-03-15
@nastya_zholudeva

It works for me without reloading, we get in the header and in the address bar, in the header text, in the address bar

onclick="history.pushState(\''.$fulluri2.'\', null, \''.$fulluri2.'=list='.$id23.'\')"

A
Alexander null, 2018-03-15
@snikes

Instead of POST, make GET itself substituted when submitting the search form

D
Dima Polos, 2018-03-15
@dimovich85

You need to wrap the input field in the form tag, write the address "/search" in the action, the get method, as mentioned above, and add a submit button in the form, for example button, or input[type=submit]. That's it, when you click on the submit, a request will be generated and the form will be sent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question