How to remove events from Fullcalendar?

Asked

Viewed 1,390 times

2

I’m wearing this:

eventClick: function (calEvent, jsEvent, view) {
    $('#calendar').fullCalendar('removeEvents', event.id);
},

My database has: id, title, start, end, username that I tried to change "event.id" for "id", but nothing seems to work. When I click on the event, all events are removed from the calendar, but not from the database. If I refresh the page they appear again.

  • 1

    Either you don’t have the full code or there’s a problem: event is a variable that does not exist. Have you seen in the browser if this javascript code is giving errors?

  • Instead of using Event.id you have to use calEvent.id or change the name 'calEvent' to Event And incidentally, to remove only one event you should use 'removeEvent' in the singular, otherwise it deletes all the same.

1 answer

1

In this case, you will have to make some call by ajax, for example, to a controller in your php, for example:

eventClick: function (calEvent, jsEvent, view) {
    $.ajax({
        url: 'calendario.php',
        data: {'calendario_id' : event.id},
        success: function() {

            $('#calendar').fullCalendar('removeEvents', event.id);

        }
    });
},

and with that in your.php calendar that will receive the request will do the action of removing from your table.

  • Check out this link https://www.webslesson.info/2017/12/jquery-fullcalandar-integration-with-php-and-mysql.html

Browser other questions tagged

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