Don’t you get full id?

Asked

Viewed 40 times

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?

1 answer

0


I found out what was wrong. The code I had written picked up the event.id but where I got the code, there’s a mistake .fullCalendar( 'removeEvents' [, idOrFilter ] ). The "," is Wrong in there, it needs to be out of "[ ]" and now it’s Working fine.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.