0
I am receiving an array in the variable "myObj" ([00, 12, 45, 34, 23, 34, 34, 34, 05, 42, 21, 11, 31]). And I needed to put this value in the series, that is, replace the array that is hardcoded there. Type: series = [myObj, ...]
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var myObj = JSON.parse(this.responseText); // Valor que tenho
}
};
xmlhttp.open("GET", "api/api_get_fogo.php", true);
xmlhttp.send();
var dataSales = {
labels: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
series: [
[00, 12, 45, 34, 23, 34, 34, 34, 05, 42, 21, 11, 31], // Onde quero substituir
[00, 24, 36, 03, 34, 10, 15, 20, 48, 19, 49, 32, 02]
]
};
It seems to me a simple question for someone who knows the least about Java, but I’m really not getting :v
– Ivónio
Do not put code as image, instead put it as text formatting appropriately in the question editor. Regardless it is not at all clear what you are trying to trade and where.
– Isac
Edited question, I hope it’s more noticeable...
– Ivónio
These are asynchronous functions, the code inside the
if
is executed long after thedataSales
have been executed.– Isac