I have the following codes that are not working: Maybe I should add something to them, but I do not know how ... JS:
<script>
$(document).ready(function(){
$('#busca').autocomplete(
{
source: "busca_empresa.php",
minLength: 1
});
});
</script>
HTML
<label for="busca">
<span>Pesquisa:</span>
<input type="text" id="busca"/>
</label>
PHP
<?
include('conecta.php');
$pesquisa = $_GET['term'];
$sql = "SELECT * from anuncios where nome_emp like '%$pesquisa%'";
$query = mysqli_query($conexao,$sql);
while ($ln = mysqli_fetch_array($query)) {
echo json_encode($ln['nome_emp']);
}