Exploring JSON for the first time and I have a couple of questions:
- Is it possible to create a JSON object using the 'data-id' attribute and have it contain a single array of numbers?
- Even though I have the code to do this, I am facing difficulties in constructing the JSON object. Here's the code snippet:
Here's the code snippet:
var displayed = {};
$('table#livefeed tr').each(function (i) {
var peopleID = $(this).attr("data-id");
//console.log("id: " + peopleID);
if(peopleID!="undefined") displayed += peopleID;
});
console.log(displayed);
However, this implementation doesn't work as intended, resulting in a concatenation of objects as a string.