I'm just learning to use the bootstrap fullCalendar and after searching for the solution I could not find it, my code is as follows:
script
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: new Date(),
navLinks: true,
editable: true,
eventLimit: true,
events: {
url: 'getEventos/',
error: function() {
alert(1);
}
}
});
});
driver
public function getEventos(){
$eventos = Eventooooo::find(1);
$evento = ['title' => $eventos->evento,
'start' => $eventos->fechaEvento,
'end' => $eventos->fechaEvento,
];
return response()->json($evento);
}
I'm sending a JSON with the indexes in the way I expect to receive it calendar so I just send the response to 'event', and indeed, as a response it is bringing me the data I need. With this code that I am using, it does not show me any errors but it does not show me the event in the calendar, I was following a tutorial where the person did not show the data so he had to do the following:
tutorial code
$(document).ready(function() {
$.get('getEventos/', function(response, state){
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: new Date(),
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow "more" link when too many events
events: $.parseJSON(response),
});
});
});
But that generates an error for me and it did not work for me. I would like to know if someone has had this same problem and how to solve it, thanks.