我想实现一个日历选项,该选项可以显示特定日期的事件列表。我从数据库查询我的结果,它在下面以JSON格式提供:
[
{
title: "No of Appointments : 48",
START: "1970-01-01"
},
{
title: "No of Appointments : 2",
START: "2017-06-14"
},
{
title: "No of Appointments : 2",
START: "2017-06-15"
},
{
title: "No of Appointments : 1",
START: "2017-06-20"
},
{
title: "No of Appointments : 1",
START: "2017-06-21"
}
]
我的jquery文件如下:
var cal = jQuery.noConflict();
cal(document).ready(function () {
function get_data() {
cal.ajax({
url: "<?php echo base_url(); ?>Reports/get_count_apointments/",
type: 'GET',
dataType: 'JSON',
success: function (data) {
var appointment_info = data;
draw_calendar(appointment_info);
}, error: function (jqXHR) {
console.log(jqXHR);
}
});
}
get_data();
function draw_calendar(appointment_info) {
cal('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: appointment_info
});
}
});
但是,以下内容将打开没有标记事件日期的日历。 因此,在特定日期没有事件的空白页面。 我该如何解决这个问题?