In this post, I will let you know how to implement full calendar integration with example.
You can also perform some basic crud operation such as you can add events for a particular date.
You can pass json type of data or array type of data in events to display the calendar.
If you need to display the data from server then pass the url in "events" key.
You can display the events based on date range. This is useful for appointment booking, event scheduling etc..
- <!DOCTYPE html>
- <html>
- <head>
- <title>jQuery Fullcalendar Integration with example</title>
- <link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.min.css" rel="stylesheet"/>
- <link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.print.css" rel="stylesheet" media="print" />
- <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.min.js"></script>
- </head>
- <body>
- <div id="calendar"></div>
- <script type="text/javascript">
- $(document).ready(function(){
- var calendar = $("#calendar").fullCalendar({
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay,listWeek'
- },
- navLinks: true,
- editable: true,
- eventLimit: true,
- events: [
- {
- title : 'event1',
- start : '2017-04-01'
- },
- {
- title : 'event2',
- start : '2017-04-03',
- end : '2017-04-05'
- },
- {
- title : 'event3',
- start : '2017-04-09T12:30:00',
- allDay : false // will make the time show
- }
- ], // request to load current events
- });
- });
- </script>
- </body>
- </html>
If you do not pass the media attribute in fullcalendar.print.css
library then you won't be able to see the prev and next button on fullcalendar header toolbar.
If you need to get data from server then you can pass the url in following way :
- $('#calendar').fullCalendar({
- events: '/events.php'
- });