On Ajax success im getting the following data in a count variable. Using(snippet of ajax call success):
success: function (count) {
console.log(count);
}
And below console.log(count) hold this data as shown in browser console:
{
'07/12/2017': {
'day': {'failed': 0, 'success': 3},
'night': {'failed': 0, 'success': 0}
},
'06/12/2017': {
'day': {'failed': 2, 'success': 20},
'night': {'failed': 1, 'success': 291}
},
'05/12/2017': {
'day': {'failed': 6, 'success': 50},
'night': {'failed': 1, 'success': 51}
}
}
My issue when i try to access the data(all within the ajax success function), say i have a variable date = '07/12/2017' and i do count[date] i get undefined, but if i manually copy and hardcode the data to count like below then count[date] will return the object inside the corresponding date:
count = {
'07/12/2017': {
'day': {'failed': 0, 'success': 3},
'night': {'failed': 0, 'success': 0}
},
'06/12/2017': {
'day': {'failed': 2, 'success': 20},
'night': {'failed': 1, 'success': 291}
},
'05/12/2017': {
'day': {'failed': 6, 'success': 50},
'night': {'failed': 1, 'success': 51}
}
}
Might be something simple but its totally escaping me right now.
Thanks in advance