i have a problem about this, i want to get the array length of my array data so that i can use it in my loop. Why i am not getting it by using this code : var arrayLength = myclinicsID.length;
, i declared myclinicsID in a global variable and i also push data with other function and then now, i want to get the length of that array so that i can use it with my loop, now here is my full code:
function getbarxAxis() {
getallclinics();
var arrayLength = myclinicsID.length;
$.ajax({
url: siteurl+"patients_report/bardata_date",
type: "POST",
dataType: "JSON",
success: function(data) {
for (var i in myclinicsID) {
categories.push(data[i]["datemonths"]);
for(var innerLoop = 0; innerLoop < arrayLength; i++) {
//getbarSeriesData(myclinicsID[innerLoop],data[i]['datemonths']);
}
}
}
});
}
here is my getallclinics();
full code where i populate the myclinicsID array:
function getallclinics() {
$.ajax ({
url: siteurl+"patients_report/seriesclinics",
type: "POST",
dataType: "JSON",
success: function(data) {
for(var i in data) {
myclinicsNAME.push(data[i]['clinic_name']);
myclinicsID.push(data[i]['clinic_id']);
}
}
});
}