I've been having the following problem since yesterday, putting together an ordered list as I'll be fetching data in the database. I was suggested to do with ajax, I did with the help of a colleague of the forum to a certain extent. However, in the search with the bank it does not return anything to me. It's always undefined, I do not think it's looking at the bank.
Follow the 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));
?>