我有这个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"
}
]
}
我正在尝试使用jQuery显示其内容:
ajaxRequest.done(function(data) {
var jdata = JSON.parse(data);
$.each(jdata, function(){
$('#mydivname').append(projects.project_name);
}
});
但是,我似乎无法访问project_name
,因为它是'undefined'。
我在这里想念什么?我觉得这很简单。预先谢谢你。