I’ve tried to use the code shared in https://discourse.hkvstore.com/t/integrating-fullcalendar-and-populating-from-json/2806/1
but I consistently get “Failure Parsing JSON” error when loading page. The calendar object appears fine, and manually added entries appear in it.
The JSON side code is in ListEvents.php:
<?php $from= Get("start"); $to= Get("end"); $sql = "SELECT `timeslotgroup_id` AS id, `timeslotgroup_name` AS 'title', DATE_FORMAT(slot_datetime_start,'%Y-%m-%dT%H:%i:%s') as 'start', DATE_FORMAT(DATE_ADD(slot_datetime_start, INTERVAL 1 HOUR),'%Y-%m-%dT%H:%i:%s') as 'end' FROM `timeslotgroups` WHERE slot_datetime_start BETWEEN '$from' AND '$to';"; echo ExecuteJson($sql); ?>when manually going to the actual JSON URL:
localhost/classroom/ListEvents?start=2020-09-13T00%3A00%3A00%2B05%3A30&end=2020-11-08T00%3A00%3A00%2B05%3A30
I get the correct output:
[{“id”:1,“title”:“Monday”,“start”:“2020-09-14T19:00:00”,“end”:“2020-09-14T20:00:00”},{“id”:2,“title”:“Tuesday”,“start”:“2020-09-15T11:00:00”,“end”:“2020-09-15T12:00:00”}]
I’ve tried every variation of date format, etc, but cannot understand why JSON parsing fails. I suppose it is the JSON data being returned which is problematic. I have ticked "no header/footer " in the Generate screen for ListEvents.php. Is there somewhere else that I have to remove header/footer also?