jQuery Fullcalendar Integration with example

jQuery Fullcalendar Integration with example

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..

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jQuery Fullcalendar Integration with example</title>
  5. <link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.min.css" rel="stylesheet"/>
  6. <link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.print.css" rel="stylesheet" media="print" />
  7. <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
  8. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  9. <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.3.0/fullcalendar.min.js"></script>
  10. </head>
  11. <body>
  12. <div id="calendar"></div>
  13. <script type="text/javascript">    
  14. $(document).ready(function(){
  15. var calendar = $("#calendar").fullCalendar({
  16. header: {
  17.                 left: 'prev,next today',
  18.                 center: 'title',
  19.                 right: 'month,agendaWeek,agendaDay,listWeek'
  20.             },
  21.             navLinks: true,
  22.             editable: true,
  23.             eventLimit: true,
  24. events: [
  25.          {
  26.          title : 'event1',
  27.          start : '2017-04-01'
  28.          },
  29.          {
  30.          title : 'event2',
  31.          start : '2017-04-03',
  32.          end : '2017-04-05'
  33.          },
  34.          {
  35.          title : 'event3',
  36.          start : '2017-04-09T12:30:00',
  37.          allDay : false // will make the time show
  38.          }
  39.         ], // request to load current events
  40. });
  41. });
  42. </script>
  43. </body>
  44. </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 :

  1. $('#calendar').fullCalendar({
  2. events: '/events.php'
  3. });

Phone: (+91) 8800417876
Noida, 201301