Fullcalendar - Eventclick Changing Url
Solution 1:
By the time eventClick runs it's too late, you already clicked on the event and the redirection to the location specified in the existing event URL has already started.
If you want to manipulate the URL values coming from the server I suggest you do this in the eventDataTransform callback, which runs before each event is rendered onto the calendar, e.g.:
eventDataTransform: function( eventData ) {
eventData.url = window.location.origin + window.location.pathname + eventData.url;
return eventData;
},
See https://fullcalendar.io/docs/event_data/eventDataTransform/ for a bit more detail on the callback.
However, I don't know exactly what format your URLs are in but I sense that your code is actually unnecessary. I think for it to make sense you must be outputting relative URLs into the calendar data e.g. "test.php" or "images/test.jpg".
If you leave these as they are and click on them, the browser will automatically prepend the current site address onto them before trying to navigate there. The code you're running just hard-codes what the browser will do automatically, and I don't think you need to bother.
Post a Comment for "Fullcalendar - Eventclick Changing Url"