var data123 =[];
function createChart() {
$.ajax({
type: 'GET',
url: "",
dataType: 'json',
success: function (data) {
obj["source"] = "Pending";
obj["percentage"] = data.totalFiles;
data123.push(obj);
}
});
var x = data123.length; // undefined
$("#chart").kendoChart({
title: {
text: "Break-up of Spain Electricity Production for 2008"
},
legend: {
position: "bottom"
},
dataSource: {
data: data123
}
});
}
$(document).ready(createChart);
$(document).bind("kendo:skinChange", createChart);
I have a function like this
What am I trying to do is
debugging result :- after ajax call success data123 store with obj and length is 1.
when it entered to createChart function data123 length became zero.
my expected result :- in first ajax call I need to set array . that global array i need to use in createChart function.
please support ,what did i wrong ?