Is there a really easy way I can take an array of JSON objects and turn it into an HTML table, excluding a few fields? Or am I going to have to do this manually?
Pivoted single-row view with headers on the left based on @Dr.sai's answer above.
Injection prevented by jQuery's .text method
$.makeTable = function (mydata) {
var table = $('');
$.each(mydata, function (index, value) {
// console.log('index '+index+' value '+value);
$(table).append($(''));
$(table).append($('').text(index));
$(table).append($(' ').text(value));
});
return ($(table));
};
- 热议问题