Carga de Json remoto
by Carlos Quintero
HTML
<table>
<thead>
<tr>
<th>id</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Saldo</th>
<th>Acumulado</th>
</tr>
</thead>
<tbody id="lista">
</tbody>
<tfoot id="pie">
</tfoot>
</table>
JavaScript
$.getJSON('https://hitcel.com/data.php',function(clientes){
for(var i = 0; i < clientes.lista.length; i++){
$("#lista").append(`
<tr>
<td>`+clientes.lista[i].id+`</td>
<td>`+clientes.lista[i].nombre+`</td>
<td>`+clientes.lista[i].apellido+`</td>
<td>`+clientes.lista[i].saldo+`</td>
<td>`+clientes.lista[i].total+`</td>
</tr>
`);
};
$("#pie").append(`
<tr>
<td colspan='3'>Total:</td>
<td>`+clientes.saldoTotal+`</td>
<td>`+clientes.saldoAcumulado+`</td>
</tr>
`)
})