我一直在使用jQuery 1.8.1完整的日历资源修改。现在我想升级到最新版本的jQuery,但它不再起作用了。我认为我的Json-String存在问题。我已经读过$ .each方法不再适用于某些数组的东西了。这是我的具体例子:
[
{
"id":79,
"name":"Florian Sauerwein",
"anwesenheit":[
{
"tag":1,
"von":"08:30:00",
"bis":"10:30:00"
},
{
"tag":2,
"von":"09:00:00",
"bis":"13:00:00"
},
{
"tag":3,
"von":"11:00:00",
"bis":"13:00:00"
},
{
"tag":0,
"von":"09:30:00",
"bis":"15:00:00"
},
{
"tag":4,
"von":"00:00:00",
"bis":"00:00:00"
},
{
"tag":5,
"von":"00:00:00",
"bis":"00:00:00"
},
{
"tag":6,
"von":"00:00:00",
"bis":"00:00:00"
},
{
"tag":7,
"von":"00:00:00",
"bis":"00:00:00"
}
]
}
]
我的控制台说:未捕获的TypeError:
Cannot use 'in' operator to search for '42' in pages/terminplaner/json-resources.php jquery.min.js:2 sjquery.min.js:2 n.extend.eachfullcalendar.js:1212 normalizeEventfullcalendar.js:929 (anonymous function)fullcalendar.js:997 $.ajax.$.extend.successjquery.min.js:2 n.Callbacks.jjquery.min.js:2 n.Callbacks.k.fireWithjquery.min.js:4 xjquery.min.js:4 n.ajaxTransport.k.cors.a.crossDomain.send.b
这里是来自fullcalendar.js的代码,我认为这就是问题所在:
var resources = options.resources;
$.each(
resources,
function(index, resource){
if(resource.id === event.resourceId) {
event.resource = resource;
}
}
);
有没有人知道如何使用最新版本的jQuery工作?