title: Fullcalendar V4 reload events. removeEventSource doesn't exist
body: <p>I'm trying to add a calendar on my site but I don't know how could be possible to reload events from an ajax source. On previous versions you can remove the event source, add the nwe one and redraw the calendar, but in this version, I read in the documentation that it only have the <code>addEventSource</code> event. </p>
  
  <p>I have a non good solution deestroying the calendar before drawing if exists, but I lose the view and day shown. Is not a good solution.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var calendar;
  var startDateSelected;  //YYY-MM-DD
  var endDateSelected;    //YYY-MM-DD
  var evTittleSelected;
  
  //Example data
  function getCalendarEvents() {
      return [{
          title: 'example1',
          start: '2019-07-15 12:00:00'
      }, {
          title: 'Example2',
          start: '2019-07-06 12:00:00',
          end: '2019-07-10 18:00:00'
      }];
  }
  
  document.addEventListener('DOMContentLoaded', function () {
      drawCalendar();
  });
  
  function drawCalendar() {
      var events = getCalendarEvents();
      var calendarEl = document.getElementById('calendar');
      if(calendar != undefined) calendar.destroy();
      calendar = new FullCalendar.Calendar(calendarEl, {
      plugins: ['interaction', 'dayGrid', 'timeGrid'],
          locale: 'es',
          selectable: true,
          editable: true,
          header: {
              left: 'prevYear,prev,next,nextYear today',
              center: 'title',
              right: 'dayGridMonth,timeGridWeek,timeGridDay'
          },
          select: function (info) {
              startDateSelected = moment(info.startStr).format("DD-MM-YYYY HH:mm:ss");
              endDateSelected = moment(info.endStr).format("DD-MM-YYYY HH:mm:ss");
              alert('de ' + startDateSelected + ' a ' + endDateSelected);
          },
          eventClick: function(info) {
              evTittleSelected = info.event.title;
              startDateSelected =  moment(info.event.start).format("DD-MM-YYYY HH:mm:ss");
              endDateSelected =  moment(info.event.end).format("DD-MM-YYYY HH:mm:ss");
              alert('de ' + startDateSelected + ' a ' + endDateSelected);
          },
          events: events
      });
      calendar.render();
  }
  </code></pre>
  
  <p>I tried to changing event source like this:</p>
  
  <pre><code>calendar.destroy();
  calendar.addEventSource( events );
  calendar.refetchEvents();
  calendar.render();
  </code></pre>
  
  <p>but without an <code>removeEventSource</code> method it only adds new events to the calendar.</p>
  
  <p>so are there any method to reload events?</p>
  
  <p><strong>New content</strong> for imptove the answer (and use the solution in comments):</p>
  
  <p>I tried to implement the event feed as per either 
  fullcalendar.io/docs/events-json-feed or 
  fullcalendar.io/docs/events-function</p>
  
  <p>when I put directly events received from an ajax call to my nodejs server, it loads perfect all of them (without good option to reload). So the format of my events object seems to be ok.</p>
  
  <p>I use this ajax request </p>
  
  <pre><code>jQuery.ajax({
      type: 'POST',
      url: '/calendar/getCalendarEvents',
      data: {
          token: localStorage.token
      },
  }).then(function success(events) {
      return events;
  }, function error(err) {
      console.log(err);
  })
  </code></pre>
  
  <p>to fill events in this format</p>
  
  <pre><code>events:  [{ 
      id: 1,
      title: 'others',
      start: '2019-07-12 00:00:00',
      end: '2019-07-15 00:00:00',
      color: '#a6a6a6' 
  }, { 
      id: 2,
      title: 'any',
      start: '2019-07-12 00:00:00',
      end: '2019-07-15 00:00:00',
      color: '#4222C3'
  }]
  </code></pre>
  
  <p>when I try to use the <code>events-function</code> I'm having an error:  <code>callback is not a function error</code></p>
  
  <pre><code>events: function(start, end, timezone, callback) {
      jQuery.ajax({
          type: 'POST',
          url: '/calendar/getCalendarEvents',
          data: {
              token: localStorage.token
          },
          success: function(events) {
              callback(events);
          }
      });
  }   
  </code></pre>
  
  <p>Using the metod events-json-feed I have the error <code>Failure parsing JSON</code> but the format is the same of the first method (that works).</p>
  
  <pre><code>events: "/calendar/main/?token=" + localStorage.token
  </code></pre>
  
  <p>so what could I doing wrong?</p>