Is there a way for me to retrieve my json object using the table header as the key and displaying the corresponding values in an HTML table?
history:{1/22/20: 2, 1/23/20: 3, 1/24/20: 5, 2/1/20: 19, 2/10/20: 32, 2/11/20: 33, 2/12/20: 33, 2/2/20: 19, 2/20/20: 35, 2/21/20: 35}
Here is the code snippet:
for (var i = 0; i <= Object.keys(response.confirmed.locations).length; i++) {
var final = response.confirmed.locations[i].history;
$("#show").append("<tr>" +
"<td>" + final['1/22/20'] + "</td>" +
"<td>" + final['1/23/20'] + "</td>" +
"<td>" + final['1/24/20'] + "</td>" +
"<td>" + final['2/1/20'] + "</td>" +
"<td>" + final['2/10/20'] + "</td>" +
"<td>" + final['2/11/20'] + "</td>" +
"<td>" + final['2/12/20'] + "</td>" +
"<td>" + final['2/2/20'] + "</td>" +
"<td>" + final['2/20/20'] + "</td>" +
"<td>" + final['2/21/20'] + "</td>" +
+"<tr>")
}