'use strict';
$(function () {
var MyValues = []; //--> for Data
function myArraysValues() {
$.ajax({
url: '/AdminLte/TestArray',
type: 'Get',
dataType: 'json',
data: { test: 'Client_Call' },
success: function (data) {
for (var i = 0; i < 8; i++) {
MyValues.push(data[i]);
}
},
error: function (data) {
alert("error");
},
})
return MyValues;
}
});
//alert(MyValues);
var salesChartData = {
labels: MyLabels,
datasets: [
{
label: "Erledigt",
fillColor: "rgb(0, 102, 0)",
strokeColor: "rgb(0, 102, 0)",
pointColor: "rgb(0, 102, 0)",
pointStrokeColor: "#66ff33",
pointHighlightFill: "#66ff33",
pointHighlightStroke: "rgb((0, 102, 0)",
data: MyValues
},
Here's my code. How could the myArraysValues() function be executed automatically? It is meant for the ChartJS (SalesChart). When add an alert(MyValues), it works, if i get ride of it, it won't Thanks