Fullcalendar how load BusinessHours from PHP

Viewed 145

When i try to load my businessHours from php
i get enter image description here


but when I paste manually in businessHours the JSON returned by PHP it work fine.
enter image description here


json is:

[ 
   { 
      "daysOfWeek":"[0]",
      "startTime":"09:00:00",
      "endTime":"19:00:00"
   },
   { 
      "daysOfWeek":"[1]",
      "startTime":"09:00:00",
      "endTime":"10:00:00"
   },
   { 
      "daysOfWeek":"[2]",
      "startTime":"09:00:00",
      "endTime":"10:00:00"
   },
   { 
      "daysOfWeek":"[3]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[4]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[5]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[6]",
      "startTime":"09:00:00",
      "endTime":"19:00:00"
   }
]

I don't know what is wrong. my JS code is: businessHours: { url: 'classes/load-orariapertura.php' }
PHP code is: https://pastebin.com/M9yL9DQn

1 Answers

Solved with: businessHours: <?php include_once('classes/load-orariapertura.php'); ?>

PHP page return Array encoded in JSON.

Related