Friday, August 23, 2019

javascript - How to display a json array in table format?

var jArr = [
{
id : "001",
name : "apple",
category : "fruit",
color : "red"
},
{
id : "002",
name : "melon",

category : "fruit",
color : "green"
},
{
id : "003",
name : "banana",
category : "fruit",
color : "yellow"
}
]


var tableData = '';
$.each(jArr, function(index, data) {
tableData += '';
});

$('div').html(tableData);

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...

IdNameCategoryColor
'+data.id+''+data.name+''+data.category+''+data.color+'

Blog Archive