0
I have been having the following problem since yesterday, putting together an orderly list as I will search for data in the database. I suggested to do with ajax, I did with the help of a colleague of the forum until a certain part. However, in the search with the bank he does not return me anything. Always from Undefined, I believe he’s not looking in the bank.
Follow code in ajax and php
AJAX Code
$('#buscar').on('click', function(){
$.ajax({
type: 'GET',
url: 'busca.php',
data: {
id: $('input[name=id]').val()
},
success: function(data){
$('.table tbody').append('<tr><td>'+data.nome+'</td></tr>')
}
})
return false
})
PHP code
$
<?php
$host='localhost:C:/bd_relatorio/clipp.FDB';
$dbh=ibase_connect($host,'SYSDBA','masterkey');
$stmt = 'SELECT NOME, ID_CLIENTE FROM TB_CLIENTE';
$sth = ibase_query($dbh, $stmt);
$id = $_GET['id'];
$sql = ibase_query("SELECT NOME FROM TB_CLIENTE WHERE ID_CLIENTE LIKE '%".$id."%'");
$row = ibase_fetch_row($sql);
die(json_encode($row));
?>
Managed to solve?
– Rafael Augusto