title: How to get events for FullCalendar from Controller?
body: <p>I have a div, where I want to show the calendar based on button click:</p>
  
  <pre><code>&lt;label class="btn" onclick="getCalendar();"&gt; Show Calendar &lt;/label&gt;
  
  &lt;div id="calendarDiv"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>The <code>getCalendar()</code> function is implemented as following: </p>
  
  <pre><code>function getCalendar() {
      var calendar = new FullCalendar.Calendar($("#calendarDiv"), {
          plugins: ['dayGrid'],
          header: {
              left: 'title',
              center: '',
              right: 'today prev,next'
          },
          buttonText: {
              today: 'Today'
          },
  
          defaultView: 'dayGridMonth',
          defaultDate: '2019-09-12',
  
          events: function(fetchInfo, successCallback, failureCallback) {
              $.post('/Customer/GetCalendarEvents',
                  $.param({
                          selectedCountryIds: getSelectionsByName('cntName'),
                          fiscalYearEnd: '31/12/2018'
                      },
                      true),
                  function (res) {
                      var events = [];
                      console.log(res);
                      $.each(res,
                          function (index, value) {
                              events.push({
                                  title: value.title,
                                  start: value.start
                              });
                          });
                      successCallback(events);
                  })
                  .fail(function () {
                  failureCallback(alert('bla')); 
              });
          }
      });
      calendar.render();
  }
  </code></pre>
  
  <p>Where, the <code>GetCalendarEvents(selectedCountryIds, fiscalYearEnd)</code> returns a Json array with a list of events that is constructed as following:</p>
  
  <pre><code>public JsonResult GetCalendarEvents(List&lt;int&gt; selectedCountryIds, string fiscalYearEnd) {
      // some initial steps to get finalList
      // creating result array
      var result = finalList.Select(r =&gt; new
      {
          title = r.Item2 + " : " + r.Item3,
          start = r.Item1
      });
      return Json(result, JsonRequestBehavior.AllowGet);
  }
  </code></pre>
  
  <p>The function returns correct array and the events[] is properly generated, however, when I run it I get nothing shown and in console I see an error: </p>
  
  <pre><code>main.min.js:6 Uncaught TypeError: e.addEventListener is not a function
      at O (main.min.js:6)
      at e.bindHandlers (main.min.js:6)
      at e.render (main.min.js:6)
      at getCalendar (ViewName:1118) // this is the line with calendar.render();
      at HTMLLabelElement.onclick (ViewName:1037)
  </code></pre>
  
  <p>Any suggestions what can be an issue and how could I resolve it? I am using the latest version of FullCalendar. </p>