【发布时间】:2023-02-24 02:38:25
【问题描述】:
我坚持使用 fullcalendar.io 和 json 提要将事件加载到日历中。
Json feed 1 with 1 event: 这工作正常 events 是 fetched 来自 url 中的 json 提要并加载到日历中。
[{"id": 9, "title": "test event", "start": "2023-02-22T03:00:00Z", "end": "2023-02-22T01:03:00Z"}]
以及相关的日历代码
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar')
var calendar = new FullCalendar.Calendar(calendarEl, {
events: { url : '{% url 'calendar_app:all_events' %}' }, --> working fine
带有 1 个事件的 Json 提要 2:这是 not 工作,再次从 url 中的 json 提要获取事件,但是 json 有一个 different format
{
"result": [
{
"id": 9,
"title": "test",
"start": "2023-02-21T04:30:00Z",
"end": "2023-02-21T06:55:00Z"
}
]
}
我必须做什么才能使用第二个 json 提要将事件加载到日历中。
【问题讨论】:
标签: javascript jquery json django