Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. $('.fc-next-button').click(function() {
  2. var month = $("#month").val();
  3. var nextMonth = ++month;
  4. $.ajax({
  5. url: 'controllerName/getNextMonthEvents',
  6. type: 'POST',
  7. data: {
  8. nextMonth: nextMonth
  9. },
  10. success: function(nextEvents) {
  11. var nextResult1 = $.parseJSON(nextEvents);
  12. $('#event_calendar').fullCalendar({
  13. header: {
  14. left: 'prev,next today',
  15. center: 'title',
  16. right: 'listDay,listWeek,month'
  17. },
  18. defaultView: 'month',
  19. editable: true,
  20. eventLimit: true, // allow "more" link when too many events
  21. events: nextResult1, //I am displaying my events here
  22. $("#month").val(nextMonth);
  23. },
  24. });
  25. });
  26.  
  27. My Controller:-
  28. public function getNextMonthEvents() {
  29. $nextMonth = $_POST['nextMonth'];
  30. $nextEvents = $this->modelName->getNextMonthEvents($nextMonth);
  31. echo json_encode($nextEvents);
  32. }
  33. My view:-
  34. public function getNextMonthEvents($nextMonth) {
  35. $where = "MONTH(start_date) = $nextMonth";
  36. $rs = $this->db->select('name as title,DATE(start_date) as start,DATE(end_date) as end')
  37. ->from('db_name')
  38. ->where($where)
  39. ->get()->result();
  40.  
  41. return $rs;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement