Populate html table on jQuery success event
Try this:
for (var i = 0; i < len; i++) {
var username = data[i].username;
var name = data[i].name;
var lastname = data[i].lastname;
$('#table tbody').append('<tr><td>'+username+'</td><td>'+name+'</td><td>'+lastname+'</td></tr>')
}
You could try this:
var table = $("#table tbody");
$.each(data, function(idx, elem){
table.append("<tr><td>"+elem.username+"</td><td>"+elem.name+"</td> <td>"+elem.lastname+"</td></tr>");
});
More information can be found here: http://api.jquery.com/jQuery.each/