[
{
id: 15,
diemdung: "a"
},
{
id: "16",
diemdung: "b",
khoangcach: "300",
pho: "c",
da: [
{
lancan: "d",
kc: "333"
},
{
lancan: "e",
kc: "322"
}
]
},
...
]
我使用PHP像print json_encode($rows);
像JSON格式,我尝试在客户端读取它使用jQuery像
$.getJSON(url,function(json){
$.each(json,function(key, val){
$.each(this.da,function(){
alert(this.kc);
});
});
});
阅读多层次JSON格式
但它不起作用。我该怎么做?感谢
什么警示说明了什么? – 2013-03-27 02:45:44
应该在每次遇到json数组中的“kc”节点值时发出警报,如果警报是alert(arrayVal.id + daData.kc)将显示第一个每个+ kc嵌套节点val的id节点,请感谢 – 2013-03-27 02:52:22
谢谢所有但它不适合我。我尝试@john S答案,它工作:) – DeLe 2013-03-27 03:20:29