Preencha a tabela html no evento de sucesso do jQuery
Aqui está o meu problema.
Eu tenho essa tabela html:
<table class="flexme" id="table" border="1">
<thead>
<tr>
<th width="100">Usuario</th>
<th width="100">Nombre</th>
<th width="100">Apellido</th>
<th width="100">Cedula/Rif</th>
<th width="140">Direccion</th>
<th width="100">E-mail</th>
<th width="100">Telefono1</th>
<th width="100">Telefono2</th>
<th width="100">Status</th>
<th width="150">Acción</th>
</tr>
</thead>
<tbody>
<tr id="test">
<td></td>
</tr>
</tbody>
</table>
e eu tenho este pedido de ajax:
$.ajax({
type : "POST",
url : "service.php",
dataType: "json",
data: {
action:"search",
type: 'users',
parameter: parameter,
parameterContent: parameterContent,
},
success:function(data) {
$('#searchResults').show();
var len = data.length;
for (var i = 0; i< len; i++) {
var username = data[i].username;
var name = data[i].uname;
var lastname = data[i].lastname;
}
})
Qual é a maneira correta de preencher a tabela html com as informações fornecidas via JSON? Eu tenho tentado sem sucesso. Eu fiz testes comappend()
html()
mas sem sucesso algum, alguém pode por favor me apontar na direção certa?
O que eu quero é pegar a informação que vem via JSON e preencher a tabela dinamicamente com esta informação.