I'm trying to add a FullCalender to my page with the events from a Google Calendar. When I don't include the eventRender, it shows the events, but takes me to Google Calendar when I click on them. When I add the eventRender to get the event information to popup when hovering over the events, I get the failure parsing JSON error and the events don't render on the calendar at all.
This is the code I'm using (note that the API key and calendar ID are filled in in the actual code):
<script>
document.addEventListener("DOMContentLoaded", function() {
let calendarEl = document.getElementById("calendar");
let calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ["dayGrid", "timeGrid", "list", "interaction", "googleCalendar"],
selectable: true,
googleCalendarApiKey: "<API KEY>",
events: {
googleCalendarId: "<my-calender-id>",
className: "gcalEvent"
},
eventRender: function(eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
placement: 'top',
container: 'body'
});
}
});
calendar.render();
});
</script>
I'm pretty new to HTML and also StackOverflow so if this is not enough information to parse out a solution let me know what I need to add.
info
parameter. Not sure how that would result in a JSON/XHR issue, but nonetheless it's definitely a problem for you, becauseeventObj
won't contain the things you think it does, and$el
will be undefined). You need to refactor your eventRender code to use the new object structure (as described in the docs). – ADyson