Fullcalendar - save events in database

亡梦爱人 提交于 2019-12-05 23:41:21

You can actually save the events in DB.

  1. Use this ajax after your modal trigger.
  2. Get the values like title,startdate, end date in modal and send them in the following ajax

    $.ajax({
      url: 'add_events.php',
      data: 'title='+ title+'&start='+ start2 +'&end='+ end2,                                                    
      type: "POST",
      success: function(json) {
        $( "#getReason" ).modal('hide');
        $('#mydiv').hide();
        $('body').removeClass('blockMask');//calendar.fullCalendar( 'refetchEvents');
        $('#calendar').fullCalendar('refetchEvents');
      }
    });
    
  3. in add_events.php save the details in db

  4. In your main page use this method for dynamically creating event source

    function eventSourceCall(){
         eventSourceCall = [
            {
                url: 'events.php?status=absent',
                backgroundColor: 'red',
                borderColor: 'white',
                textColor: 'white',
                rendering: 'background',
                cache: false
            }
    
  5. in events.php perform a select operation and retrieve the event parameters as json encoded objects and return them.

  6. In calendar function eventSources: eventSourceCall, add this line for selecting the event source.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!