我尝试开发一个小的网络日历。用户获得一周的概览,如果他按下“下周给我看”,接下来的 7 天应该使用 jQuery 异步加载。JSON 数据如下所示:
{
"user":[
{
"id":"12345",
"days":{
"09-07-2012":{
"10:00":{
"time":"10:00",
"length":"30",
"appointmentid":"159487"
},
"11:00":{
"time":"11:00",
"length":"30",
"appointmentid":"159487"
},
"12:00":{
"time":"12:00",
"length":"30",
"appointmentid":"159487"
}
},
"10-07-2012":{
"10:00":{
"time":"10:00",
"length":"30",
"appointmentid":"159487"
},
"11:00":{
"time":"11:00",
"length":"30",
"appointmentid":"159487"
},
"12:00":{
"time":"12:00",
"length":"30",
"appointmentid":"159487"
}
},
"11-07-2012":{
"10:00":{
"time":"10:00",
"length":"30",
"appointmentid":"159487"
},
"11:00":{
"time":"11:00",
"length":"30",
"appointmentid":"159487"
},
"12:00":{
"time":"12:00",
"length":"30",
"appointmentid":"159487"
}
}
}
}
]
}
我如何处理这些数据并将其显示在 html 表中?使用 jQuery 函数,我只能步行抛出第二维......所以我只能得到 id 和 days ......
$.each(data.user, function(i,data){
...
}
那么我怎样才能扔掉整个数组并用数据填充我的 ui 呢?我应该使用嵌套的每个函数吗?
问候托马斯