I need to build a table or panel/card with the json data.
I want to print the first one, then erase everything and print the next one.
I've tried with tables, panels and it didn't work.
I want to do something like the pic below.
Here's the code.
const js = [{
"category": "Apoio",
"serviceSecondLevel": "CTB - Contabilidade",
"serviceFirstLevel": "Contabilidade",
"status": "Novo",
"createdDate": "2019-04-17T12:47:51.0299221",
"ownerTeam": "Administradores",
"id": 13062,
"customFieldValues": [{
"items": [{
"customFieldItem": "Crítica"
}],
"customFieldId": 18289,
"customFieldRuleId": 8423,
"line": 1,
"value": null
}],
"clients": [{
"businessName": "Usuario"
}]
}, {
"category": "Apoio",
"serviceSecondLevel": null,
"serviceFirstLevel": "ADM - Administrativo",
"status": "Novo",
"createdDate": "2019-04-17T14:35:50.6543365",
"ownerTeam": "Administradores",
"id": 13133,
"customFieldValues": [{
"items": [{
"customFieldItem": "Baixa"
}],
"customFieldId": 18289,
"customFieldRuleId": 8423,
"line": 1,
"value": null
}],
"clients": [{
"businessName": "Usuario"
}]
}];
js.forEach(function(o) {
var area = o.serviceSecondLevel == null ? o.serviceFirstLevel : o.serviceSecondLevel;
$('#area').text(area);
$('#numero').text(o.id);
$('#solicitante').text(o.clients[0].businessName);
$('#categoria').text(o.category);
$('#status').text(o.status);
$('#severidade').text(o.customFieldValues[0].items[0].customFieldItem);
$('#data').text(o.createdDate);
$('#hora').text(o.createdDate);
sleep(30);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
<tbody>
<tr>
<td id="area"></td>
<td id="numero"></td>
</tr>
<tr>
<td id="solicitante"></td>
<td id="categoria"></td>
</tr>
<tr>
<td id="status"></td>
<td id="severidade"></td>
</tr>
<tr>
<td id="data"></td>
<td id="hora"></td>
</tr>
</tbody>
</table>
It's only printing the first object, it never prints the next.