0
I have the following objects returning in values:
duasSemanas:
2021-02-18: {TOTAL: 20, OUTROS: 8, VALIDOS: 12, MEDIA: 841.8600000000001}
2021-02-19: {TOTAL: 20, OUTROS: 6, VALIDOS: 11, MEDIA: 774.84}
2021-02-22: {TOTAL: 21, OUTROS: 10, VALIDOS: 12, MEDIA: 772.55}
2021-02-23: {TOTAL: 19, OUTROS: 7, VALIDOS: 12, MEDIA: 1029.3799999999999}
primeiroTrimestre:
2020-03-10: {VALIDOS: 13}
2020-03-11: {VALIDOS: 11}
2020-03-12: {VALIDOS: 7}
2020-03-13: {VALIDOS: 10}
2020-03-14: {VALIDOS: 11}
And I’m assigning the dates to an array as shown below:
$('document').ready(function() {
$.post("./chart.php", function(dados, status){
var valores = JSON.parse(dados);
var diasDuasSemanas = [];
var diasPrimeiro = [];
var diasSegundo = [];
var diasTerceiro = [];
var diasUltimo = [];
for (var d in valores['duasSemanas'])
{
diasDuasSemanas.push(d);
}
for (var p in valores['primeiroTrimestre'])
{
diasPrimeiro.push(p);
}
. . .
My question is: How do I access the ASSOCIATIONS Total, Validos, Others... and assign them to an array?
var arrayTotal = []
For example: dayFirst(every day) : arrayTotal(all totals according to day)
Help me please, it’s of utmost importance!
Your first snippet is not a valid JSON, so the line
JSON.parse(dados)
would make a mistake. Are you sure that’s the information you get?– Woss
Yes, when I put in the chart Chart appear the dates too, I copied the direct return from the console
– brz_core
But it is not a valid JSON, so its code doesn’t make much sense. It could make a [mcve] demonstrating the problem?
– Woss
I only need to access the third array within the previous 2
– brz_core