Dondada
Dondada

Reputation: 441

FullCalendar.js json events

I'm having issues attaching events from a json file to the calendar. The calendar successfully builds but doesn't append the events.

I uploaded the json file for you guys to view: https://api.myjson.com/bins/1dfki

HTML:

<html>
<head>
    <title>Bootstrap Calendar</title>

    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="style.css">

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js"></script>

<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.0.2/fullcalendar.min.js"></script>

    <script type="text/javascript" src="script.js"></script>

</head>
<body>
<div id="calendar"></div>

</body>
</html>




$(document).ready(function() {

$('#calendar').fullCalendar({
events: 'https://api.myjson.com/bins/1dfki'
    });

});

Upvotes: 3

Views: 3224

Answers (1)

bryjohns
bryjohns

Reputation: 656

According to the documentation JSON feed is expected to be an array of Event objects. http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/ - first sentence. I made an example feed using the data you provided in yours (modified so it had 3 real dates). https://api.myjson.com/bins/1zibm. You tried to make an Agenda object but it just expects Event objects in an array.

Upvotes: 1

Related Questions