My JSON looks like this:-
{
"tblDetails": [{
"id": 1,
"rowIndex": 1,
"colIndex": 1
},
{
"id": 2,
"rowIndex": 1,
"colIndex": 2
},
{
"id": 3,
"rowIndex": 1,
"colIndex": 4
},
{
"id": 4,
"rowIndex": 1,
"colIndex": 6
}
]}
And HTML Structure as below:-
<table id="tblLayout"><tbody> </tbody></table>
I am using jQuery ajax to fetch JSON data.
$.ajax(
{
url : "/hello/data.json",
type: "GET",
success: function(data)
{
var tbl = data.tblDetails;
tbl.forEach(item)
{
var html = item.id;
$('#tblLayout> tbody > tr:eq('+(item.rowIndex)+') td:eq('+(item.colIndex)+')').append(html);
}
},
error:function(e)
{
}
})
Now how do I append the html at the specified row-col in the table tblLayout.