I have this JSON:
{
"projects": [
{
"id": 1,
"children": [
{
"id": 2,
"parent_id": 1,
"project_name": "Carmichael Kitchen"
},
{
"id": 3,
"parent_id": 1,
"project_name": "Carmichael Master Bedroom"
},
{
"id": 4,
"parent_id": 1,
"project_name": "Carmichael Living Room"
}
],
"parent_id": 0,
"project_name": "Carmichael"
}
]
}
I am trying to display its contents with jQuery:
ajaxRequest.done(function(data) {
var jdata = JSON.parse(data);
$.each(jdata, function(){
$('#mydivname').append(projects.project_name);
}
});
However, I can't seem to access project_name
as it is 'undefined.'
What am I missing here? I feel it is something really simple that I am overlooking. Thank you in advance.