Jquery Fullcalendar JSON编码和Laravel
我有一个日历显示在一页上,但我一辈子都不能让它工作。我在我的控制器中创建了一个数组,将其传递给视图json_编码,但fullcalendar不希望拾取该数组并将其弹出到日历中。请参阅下面我的代码: HomeControllerJquery Fullcalendar JSON编码和Laravel,jquery,laravel,laravel-5,fullcalendar,Jquery,Laravel,Laravel 5,Fullcalendar,我有一个日历显示在一页上,但我一辈子都不能让它工作。我在我的控制器中创建了一个数组,将其传递给视图json_编码,但fullcalendar不希望拾取该数组并将其弹出到日历中。请参阅下面我的代码: HomeController public function calendar_feed(){ return response()->json( [ 'title' => 'Matts Booking', 'start' => '2018-01-01
public function calendar_feed(){
return response()->json(
[
'title' => 'Matts Booking',
'start' => '2018-01-01T22:40',
'end' => '2019-01-01T23:40'
], 200
);
}
完整日历功能
<script type="text/javascript">
(function ( $ ) {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
editable: false,
defaultView: 'agendaWeek',
firstDay: 1,
eventLimit: false, // allow "more" link when too many events
navLinks: true,
events: '{{ route("calendar_feed") }}'
});
}( jQuery ));
</script>
任何帮助都将不胜感激
非常感谢根据属性
events
的名称,它似乎需要一个数组,因此添加一对额外的方括号:
public function calendar_feed(){
return response()->json([[
'title' => 'Matts Booking',
'start' => '2018-01-01T22:40',
'end' => '2019-01-01T23:40'
]], 200
);
}
现在返回一个包含单个元素的对象数组。Ivan,如果我能吻你,我会的!谢谢你,它工作得很好!
public function calendar_feed(){
return response()->json([[
'title' => 'Matts Booking',
'start' => '2018-01-01T22:40',
'end' => '2019-01-01T23:40'
]], 200
);
}