I have an object called data. Within this object there is another object (or array, I'm not sure....), called maps. To reach maps I just do data.maps and this works on all browsers except for IE. When I console.log(data);
i get this:
{
"maps": [{
"Media_Map_Id": "55",
"Media_Id": "657"
}]
}
When I console.log(data.maps);
it says undefined....
I also got this error, it might have something to do with it eventhough I already fixed it.
Unable to get property 'length' of undefined or null reference
code:
if(data.maps) {
dMapsLength = data.maps.length;
} else {
dMapsLength = 0;
}
for (var i = 0; i < dMapsLength; i++) {
createVars(data.maps[i], i);
}
SOLVED (credits to evolutionxbox):
if (typeof(data) !== 'object') {
data = JSON.parse(data);
}
**Can't access object property, even though it exists. Returns undefined** https://stackoverflow.com/a/17547032/4876771 Please check it and mark this accordingly. – Gregg Od Aug 16 '17 at 08:01