I've been looking for some way to append td to tr to table using jQuery without knowing anything about my json response, at this point in time I've reached this:
function getClientes(){
$.ajax({
url:URL_BASE+"Cliente",
type:"GET",
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa("hola" + ":" + "hola"));
},
success: function (data){
$.each(data,function(index,value){
$('<tr>').append(
$.each(value,function(value,celda)
{
$('<td>').text(celda);
})
).appendTo('#table');
})
}
});
}
The problem is that I'm getting my .html output like this:
<table id="table" class="table table-condensed">
<tr></tr>
<tr></tr>
</table>
So this is not appending the td to the tr, I do not want to append them mannually I know it is very easy to do it but this is way better for me, please help :D
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…