【发布时间】:2012-02-25 18:00:46
【问题描述】:
我正在尝试在 django 中使用这个 eventCalendar:http://jquery-week-calendar.googlecode.com/svn/trunk/jquery.weekcalendar/full_demo/weekcalendar_full_demo.html
我想自己编写 ajax 代码,但另一方面我是 jquery ajax 的新手,我想发送包括 startTime、endTime 等在内的事件数据以在日历上显示:
$('#calendar').weekCalendar({
data: function(callback){
$.getJSON("{% url DrHub.views.getEvents %}",
{
},
function(result) {
callback(result);
}
);
}
});
此日历以这种格式获取数据:
return {
events : [
{
"id":1,
"start": new Date(year, month, day, 12),
"end": new Date(year, month, day, 13, 30),
"title":"Lunch with Mike"
},
{
"id":2,
"start": new Date(year, month, day, 14),
"end": new Date(year, month, day, 14, 45),
"title":"Dev Meeting"
},
...
]
};
如何在getEvents 视图中格式化从数据库中提取的数据?
【问题讨论】: