I want to take a variable derived from an HTML form submission, and place it inside of a window.location.replace
link.
HTML:
<form action="search.js" type="search">
<input type="text" name="searchInput" class="textbox" placeholder='' maxlength="10" />
</form>
On form submission, I've assigned searchInput to a JS variable.
Then, I want to place it after the ?query= in the link below:
https://www.youtube.com/channel/.../search?query=SEARCHINPUT
Is there a way to do this using JavaScript like below? Or is there a better solution using PHP?
window.location.replace="https://www.youtube.com/channel/.../search?query=[var=searchinput]