【发布时间】:2014-11-13 10:21:58
【问题描述】:
我正在尝试解析 Google 日历提要中的条目,但到目前为止我无法检索标题,我希望有人能给我建议。从我在 firebug 中看到的内容,我无法理解为什么以下内容不起作用,因为我使用 each 方法遍历条目,如下所示:
$.getJSON("https://www.google.com/calendar/feeds/cide.edu_sm151i2pdhu2371vq8hamcver4@group.calendar.google.com/public/full?q="+encodeURI($(this).val()), {"alt" : "json"}, function(data) {
$.each(data.feed.entry, function(i, entry) {
var key = entry.gd$when[0].startTime.substr(0, 10);
if(key in SelectedDates == false) {
SelectedDates[key] = [];
}
else {
var titulo = escape(this.title.$t);
SelectedDates[key].push(titulo);
}
});
});
我之前将 SelectedDates 定义为一个数组,但是每当我提出请求时,SelectedDates 数组都包含键,但其中只有空白数组,如下所示:2014-02-04 [] 我希望我能掌握如何传递标题事件到对象。
【问题讨论】:
-
您使用的是 Calendar v2 API,该 API 已于 3 年前弃用,并于 11 月 17 日宣布关闭。考虑迁移到新版本:developers.google.com/google-apps/calendar
标签: javascript jquery google-calendar-api