0
Good afternoon, I’m getting an error that particularly I’ve never seen, when trying to use jquery autocomplete, follows the image, and the encoding:
PHP: (I used as an example, because I didn’t add like in select, these are dynamic values!
<?php
require_once('acessabanco.php');
$objDb = new db();
$link = $objDb->conecta_banco();
$sql = "SELECT p.sequencia codigo,
p.nome_completo nome,
c.data_nascimento data,
t.celular_1 celular
FROM pessoas p,
clientes c,
telefones t
WHERE p.sequencia = t.cod_pessoa
AND c.cod_pessoa = p.sequencia";
$exec = mysqli_query($link, $sql);
if ($exec){
while ($clientes = mysqli_fetch_array($exec)){
$vetor[] = array('Sequencia' => $clientes['codigo'], 'Nome' => $clientes['nome']);
}
echo json_encode($vetor);
}
JQUERY:
$.getJSON("php/lista_clientes.php", function(data){
var teste = [];
$(data).each(function(key, value){
teste.push(value.Nome);
});
});
$( "#buscar_cliente" ).autocomplete({
source: teste
});
You’re making my mistake again.. NOTE: If I use the example of the jquery site itself, it works normally, but when I search the database it shows me this..
If anyone knows what this is about, I’d be very grateful!
It worked!! Thank you so much for your help!
– Joao Pedro