我正在使用带有Codeigniter的jQuery Fullcalendar。首先,我有一张有时间表和名字的桌子。当我加载日历页面时,我正在向fullcalendar.js
发送数据,但我想要在ajax响应中。我如何继续?请帮帮我。如何在jquery fullcalendar中通过ajax响应发送日历事件
我试过下面的代码。
function get_locationdata(start, end) {
$.ajax({
type: "POST",
url: '<?php echo base_url(); ?>/index.php/Task_controller/get_schedulelocationsdata',
data: {
start: start,
end: end,
user_id: user_id
},
success: function(resp) {
defaultEvents = resp;
}
});
}
defaultEvents = resp;
<script src = '<?php echo base_url(); ?>assets/plugins/fullcalendar/dist/fullcalendar.min.js'></script>
<script src = "<?php echo base_url(); ?>assets/pages/jquery.fullcalendar.js"></script>
defaultEvents
是我发给jquery.fullcalendar.js
和RESP我得到json_encoded
data.I想用Ajax响应事件发送到fullcalendar.js
数组。
正常情况下,您可以直接通过提供URL(如果它符合fullCalendar指定的内容,则按照以下内容直接告诉fullCalendar事件数据的位置):https://fullcalendar.io/docs/event_data/events_json_feed/。 ,因为你使用的是POST请求,所以它不符合要求,所以除非你可以改变它,否则你可以使用这个模式:https://fullcalendar.io/docs/event_data/events_function/。试试看。如果你被卡住了,post – ADyson
PS“jquery.fullcalendar.js”是jQuery的副本,还是fullCalendar的副本?如果是jquery,则应该添加_before_ fullCalendar(并且还需要其他依赖项,如momentJS,如https://fullcalendar.io/docs/usage/)。如果它是fullCalendar的另一个副本,那么你应该删除它,因为你已经在它上面的行上加载了fullCalendar。 – ADyson
jquery.fullcalendar.js是fullcalendar的副本。 – Anuradha