I am using in my internal search Jquery where when entering the first letter, the name of the users referring to the letter entered appears. So far it works correctly, the problem is that the query I'm using, it searches another table of the foreign key and has also included a Count. Something like this:
SELECT *, COUNT(COMP.IdCompras) AS QTDComprasEfetuadas FROM usuario USU INNER JOIN compras COMP ON USU.IdUsuario = COMP.IdUsuario;
But I'm feeling a bit slow to get the names and I would like to put a loading and the search button to appear only after the query executed. The code I have is this:
<div class="input-group">
<input type="text" name="Nome" class="form-control col-md-8" placeholder="Digite o nome do usuário" id="usuario" aria-label="Buscar por nome" aria-describedby="btnGroupAddon2">
<div class="input-group-prepend">
<button type="submit" class="input-group-text" id="btnBuscar" style="cursor: pointer"><i class="fas fa-search"></i></button>
</div>
</div>
<script>
$(function () {
$("#usuario").autocomplete({
source: 'processar-busca.php'
});
});
</script>