avirajkhare00
avirajkhare00

Reputation: 79

fullcalendar.io : jsonfeed is not working

I am trying to load JSON data using jsonfeed as displayed blow.

$('#calendar').fullCalendar({
    events: '/myfeed.php'
});

I am getting JSON data but it is not getting displayed on Calendar. Blow is JSON data.

{
  "events": [
    {
      "start": "2017-04-25",
      "title": "Event1"
    },
    {
      "start": "2017-04-26",
      "title": "Event2"
    }
  ]
}

Also I am unable to get any nice tutorial on it. It will be much better if tutorial is also provided.

Upvotes: 0

Views: 101

Answers (2)

Konstantin Kazantsev
Konstantin Kazantsev

Reputation: 58

When your JSON file does not have 'end' field, it would only pass through 'allDay' events. I have tested this on my site. Also, keep in mind that FullCalendar nulls out end field if it is the same as start field to reduce the amount of data that is pushed to FullCalendar if you are using the utils.php file.

If that does not help, you would also want to check the format of the text. I have noticed that FullCalendar likes UTF-8 format. In the myFeed.php, make sure to convert the text before decoding the file:

$json = mb_convert_encoding($json, 'UTF-8',mb_detect_encoding($json, 'UTF-8, ISO-8859-1', true));
$input_arrays = json_decode($json, true);

Hope this helps.

Upvotes: 1

uvishere
uvishere

Reputation: 430

When you call events as a json field:

$('#calendar').fullCalendar({
    events: '/myfeed.php'
});

Here is a URL that FullCalendar might visit:

/myfeed.php?start=2013-12-01&end=2014-01-12&_=1386054751381

But, in your json file, there is no field named end. Try adding it.

Also, there are other ways you can find here to get the JSON value from file.

Upvotes: 0

Related Questions