Таким образом, у меня JSON данные анализируются во внешнем интерфейсе через Ajax вызов. Формат данных JSON выглядит примерно так:
{
"num_meetings":{
"EOF/TRiO":{
"4 Meetings":1,
"11 Meetings":1
},
"Learning Center":{
"1 Meetings":8,
"2 Meetings":10,
"3 Meetings":4,
"4 Meetings":9,
"5 Meetings":2,
"6 Meetings":1,
"7 Meetings":2,
"8 Meetings":1,
"13 Meetings":1
},
"Student Success Coach Office":{
"3 Meetings":2,
"4 Meetings":1
}
}
}
Как бы я отобразил это в таблице на переднем конце?
Я пытался приблизиться к этому с помощью этого фрагмента:
var tabular = resp.msg.num_meetings;
var html = "";
html += "<table class='table small table-responsible-sm table hover table-sm table-stripped'>";
html += `<tr><th>Location</th><th>Attended</th></tr>`;
tabular.forEach(function(elem,index) {
html += `<tr>`;
html += `<td><b>${elem.???}</b></td>`;
html += `</tr>`;
});
html += "</table>";
return html;
Я не уверен, как получить доступ к элементам внутри num_meetings.
Таблица может выглядеть примерно так :
----------------------------------
Location | Meetings | Attendance
----------------------------------
EOF/TRio | 4 Meetings | 1
----------------------------------
EOF/TRio | 11 Meetings | 1
----------------------------------
Learning Center ....