0
My question is this, I have a table on MySQL
with id
, pesquisa
and data
. I want to give a select
in this table on php
and return by ajax
so that I can insert each element into a td
specific within a table
. How can I do that?
<div class="janelaLateral">
<table id="tdTeste" name="tableConteudoPesquisado" cellpadding="0" cellspacing="0">
<tr>
<td>id</td>
<td>Data</td>
<td>Pesquisa Realizada</td>
</tr>
</table>
</div>
function fImprimir(){
$.ajax({
url: "php/listarPesquisaRealizadaBanco.php",
type: "GET",
dataType: "json",
success:function(ret){
$("#tdTeste").append(ret);
}
});
}
$resultado = mysqli_query($conn, "SELECT * FROM tabelaProva");
$contador = 0;
while($row = mysqli_fetch_assoc($resultado)){
$retorno[$contador] = $row["id"];.$row["pesquisa"].$row["data"];
$contador++;
}
mysqli_close($conn);
echo json_encode($retorno);