I have problem with full calendar, im using laravel framework. im try to showing data in my tabel to full calendar but showing error.
Error Uncaught TypeError: Cannot read property 'hasTime' of undefined
This Is My Controller
public function calendarmodul()
{
$caledarmodul = Modul::all();
return $caledarmodul;
}
This is My view
$(function () {
$('#calendar').fullCalendar({
eventSources: [
{
url: "{{ url('calendar-modul') }}",
type:"GET",
dataType: "JSON",
error: function()
{
alert("error");
},
success: function()
{
console.log("successfully loaded");
}
}
],
editable :false,
droppable :false,
})
});
This is because you are providing wrong parameters for full calendar . Your JSON data should look something like this:
{
title: 'Event Title1',
start: '2015-03-17T13:13:55.008',
end: '2015-03-19T13:13:55.008'
},
{
title: 'Event Title2',
start: '2015-03-17T13:13:55-0400',
end: '2015-03-19T13:13:55-0400'
}
Console log your response and check it matches the format for full calendar.
Also return your response as json
return json_encode($data);
To select custom fields, you can do something like:
$data = Modul::select('name as title', 'start_date as start', 'end_date as end'->get();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.