I have an ajax getting values from db, and the result is pushed into an array:
function pushPONFail(dt, ct) {
if (ct < 12) {
var tMon = parseInt(dt.getMonth())+1;
var tYear = dt.getFullYear();
ct++;
} else {
return;
}
data = {"qType": 101,
"tbl": 'qualitypqa.dbo.centerthickness',
"month": tMon,
"year": tYear,
"type": 'Lotrafilcon B'};
$.ajax({
cache : false,
url: "getrpt.php",
type: "get",
data: data,
contentType: 'application/json; charset=utf-8',
async: true,
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("error: "+textStatus+" : "+errorThrown);
}
})
.done(function(response){
var obj = jQuery.parseJSON(JSON.stringify(response));
arrPONFail.push({Month: months[tMon-1]+"/"+tYear, PONFail: obj[0].PONFail});
dt = new Date(dt.setMonth(parseInt(dt.getMonth()) - 1));
pushPONFail(dt, ct);
});
} // pushing values such as ["May/2017", 0]
$(function() {
var dt = new Date();
pushPONFail(dt, 0);
console.log(arrPONFail);
});
These are the complete function. When I console.log the array, it came out as my picture. I'm unable to extract the data.
When I print the array into the console, it came out as the picture below.
How do I get the values back out from the array? When I do an arrT[0], I get an undefined.
Please advise.