You can call the result via ajax and create an autocomplete list using the component Vanilla Javascript Autocomplete
You will give the autocomplete on the return of the call in Javascript:
function ShowModalRelMapaAeronave() {
$.ajax({
type: 'POST',
url: BASE_SITE + '/Projeto/Projeto/BuscarAeronaves',
data: { },
success: function (data) {
new autoComplete({
selector: '#TxtAeronave',
minChars: 2,
source: function (term, suggest) {
term = term.toLowerCase();
var choices = data;
var matches = [];
for (i = 0; i < choices.length; i++)
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
suggest(matches);
}
});
$('#modalRelMapaAeronave').modal('show');
}
});
}
Here in case I call the post in a route, I take the return and put in a txt of my html, so when it goes typing will autocomplete. You need to add javascript and css from the library.
The route is responsible for making the query.
What you want is AJAX
– rbz
You need to use Ajax. https://www.w3schools.com/js/js_ajax_php.asp
– Bsalvo
And how to make the search result a dropdown and user click the result to fill the field?
– Felipe Moura Shurrab