In a simpler way:
Place a function that redirects to the concatenated URL with the input value
SCRIPT
function myFunction(){
//o valor da variavel parametro é o valor do input de id=busca
var parametro = document.getElementById("busca").value;
//redireciona para o url indicado concatenado com o valor da variavel parametro
window.location.href = "http://google.com/" + parametro;
}
HTML No need for tag form
<input type="text" name="busca" id="busca">
<br>
<button type="button" onclick="myFunction()">Submit</button>
See working
function myFunction(){
var parametro = document.getElementById("busca").value;
console.log ("http://google.com/" + parametro);
}
<input type="text" name="busca" id="busca">
<br>
<button type="button" onclick="myFunction()">Submit</button>
You have to do it with
javascript
, because the Submit of the kind get always assemble the fields as well as parameters in the url (name=value)– Ricardo Pontual
Wouldn’t it be the case to send a form method="post" and simply redirect on the server side? So it would be compatible with any client, even the older ones (and the user wouldn’t even see the target URL in the browser)
– Bacco