I have a well-structured code of fullcalendar
where I can do anything but one thing. When I click on event
, I wanted it to erase and remove from the calendar. It deletes from the database but does not remove it from the 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 code above, it deletes from the database but does not remove the event, even referring to event.id
which I think should be as it should be by HERE shown.
Does anyone know what's wrong?