Wypełnij tabelę html na zdarzeniu jQuery
Oto mój problem.
Mam tę tabelę 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>
i mam to żądanie 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;
}
})
Jaki jest właściwy sposób wypełnienia tabeli html informacjami pochodzącymi z JSON? Próbowałem bez powodzenia. Zrobiłem testy zappend()
html()
ale bez powodzenia, czy ktoś może wskazać mi właściwy kierunek?
Chcę pobrać informacje pochodzące z JSON i dynamicznie wypełnić tabelę tymi informacjami.