Hi got a weird problem parsing JSON for some reason can’t access the values contained, can’t see that I’m doing anything wrong but guessing i’m doing something silly any help would be greatly appreciated.
Json –
{
"toilClaims": [
{
"id": "1",
"name": "jonathan",
"date": "12/12/2011",
"hours": "8",
"reason": "asdasda"
},
{
"id": "2",
"name": "jonathan",
"date": "12/12/2011",
"hours": "3",
"reason": "sdasdasdasd"
},
{
"id": "3",
"name": "trvor",
"date": "12/2/2",
"hours": "we",
"reason": "asda"
}
]
}
I won’t include all js but in a return function from a ajax call (data comes back fine), I simply try the following:
function listSetup(data, refresh) {
console.log(data.toilClaims.id[2]);
}
How ever it fails to find the id, I can however access data.toilClaims ???
Help lol
In this case, toilClaims itself is the array. Try this: