1
I have a well structured code of fullcalendar
where I can do anything but one thing. When I press the event
, i wanted it to delete and remove from calendar. It deletes from database but does not remove from calendar.
This is the code I have
events: [
<?php
$data = date("yy-mm-dd");
$select=mysqli_query($db, "SELECT * from aulas");
while($mos=mysqli_fetch_assoc($select)){
$id_cat=$mos['id_categoria'];
$sel_cat=mysqli_query($db, "SELECT * from categorias where id = '$id_cat'");
$mos_cat=mysqli_fetch_assoc($sel_cat);
$titulo=$mos_cat['nome'];
?>
{
title: '<?=$titulo; ?>',
color: '<?=$mos_cat['cor']; ?>',
start: '<?=$mos["data"]; ?>T<?=$mos["inicio"]; ?>',
ini_hour: '<?=$mos["inicio"]; ?>',
id: '<?=$mos["id"]; ?>',
fin_hour: '<?=$mos["fim"]; ?>',
end: '<?=$mos["data"]; ?>T<?=$mos["fim"]; ?>',
},
<?php } ?>
],
As you can see, I define the id there and everything is presented correctly.
eventClick: function(event, delta, revertFunc) {
swal({
title: "Deseja apagar este evento?",
text: event.title,
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Apagar",
cancelButtonText: "Cancelar",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
$.ajax({
type: "POST",
url: "cod_ajax/apaga_event.php",
data: "id="+event.id,
cache: false,
success:function(e){
$("#calendar").fullCalendar( 'removeEvents' [ event.id ] )
$("#pop").hide(0);
$("#pop").fadeIn("fast");
}
})
});
},
With the above code, it deletes from the database but does not remove the event even referring event.id
I think this is the way I should put it HERE shown.
Someone knows what’s wrong?