I need to retrieve information from a json
file in order to populate a table. I only want to request a maximum of 5 items.
jQuery.getJSON("data/data.json", function(data) {
var table = $("table");
$.each(data, function(id, elem) {
table.append("<tr class='text-center'><td>" + elem.dato1 + "</td><td>" + elem.dato2 + "</td></tr>");
});
})
Alternatively, I could include a boolean key "active" in the data and filter out only the items with the value set to true. How can I implement this feature?