Hi, im using Full Calendar as a librery with laravel.
In the view:
// Receive data
events: function(start, end, timezone, callback) {
console.log('nomes 1 cop :( ');
$.ajax({
url: SITEURL + "/cargarCalendarioActividadesPlanificadas",
type: "POST",
data: {
ubicacion_id: $('#ubicacion').val()
},
success: function(data2) {
console.log(data2.response);
callback(data2.response);
}
});
},
On the controller:
$data = [];
$colores = ["#00FF00", "blue", "green", "brown"];
foreach ($eventos as $evento) {
$data[] = [
'id' => $evento->ACT_ID_ACTIVITAT,
'title' => $evento->PLA_DESC_CURTA,
'start' => $evento->ACT_DATA_PLANIF,
'end' => $evento->ACT_DATA_PLANIF,
'background-color' => $colores[rand(0,3)],
'description' => $evento->PLA_DESCRIPCIO,
];
}
return response()->json(array( 'result' => true, 'response' => $data ));