0
{
"code":100,
"data":{
"month":[
{
"yearText":"2011",
"months":[
{
"monthText":"6",
"days":[
{
"dayText":"13",
"cios":[
{
"status":"continues",
"start":"23:00:00",
"end":"23:59:59",
"id":12
}
],
"bois":[
{
"status":"continues",
"start":"23:30:00",
"end":"23:59:59",
"id":12
}
]
},
{
"dayText":"14",
"cios":[
{
"status":"continued",
"start":"00:00:00",
"end":"01:00:00",
"id":12
},
{
"status":"within",
"start":"11:42:14",
"end":"11:43:45",
"id":11
}
],
"bois":[
{
"status":"continued",
"start":"00:00:00",
"end":"00:30:00",
"id":12
},
{
"status":"within",
"start":"11:42:39",
"end":"11:43:33",
"id":11
}
]
}
]
}
]
}
],
"next":"\/attendance\/get-history\/2011\/07",
"previous":"\/attendance\/get-history\/2011\/05"
},
"msg":"Attendance history of John Doe on June, 2011."
}
被zendframework生成此JSON输出文件,我试图访问里面的“月”的对象:通过jQuery的字符串,它看起来像一个数组。访问JSON输出由zendframework与jquery
我试图访问它们像通常的对象,如在month.yearText没有运气,我没有做它的权利。
有帮助吗?请。
感谢
您可以通过选择它,在'{}'按钮点击格式化你的代码。 – 2011-06-15 08:58:24
你已经说过了:*月份看起来像一个数组*。你如何访问数组? – 2011-06-15 09:27:02
@Felix Kling:那么,Javascript是非常灵活的。因此,您可以使用month ['yearText']或month.yearText在有关联数组时使用该值(请参见[Javascript - Objects as associative array](http://www.quirksmode.org/js/associative。 HTML))。 @hilarl:你可以发布你正在使用的JS代码,或者 - 不合格 - 你是否尝试过使用Firebug来检查你的假设是否正确? – wimvds 2011-06-15 11:02:55