Integrating jQuery fullcalendar into PHP website

前端 未结 11 861
夕颜
夕颜 2021-02-01 09:28

I would like to integrate the jQuery fullcalendar into my PHP website, but I don\'t know how to handle the event and how to use the JSON data from MySQL.

Any advice wou

相关标签:
11条回答
  • 2021-02-01 10:05

    I'm not familiar with jquery. But I think the problem is that you are not taking into account the asynchronous nature of Ajax.

    Unless fullCalendar() does something very odd (fires off an Ajax request and waits for the response), then you will not be able to use an external source in the function in that way, because fullCalendar will have finished running by the time a response comes back from the server.

    There does not appear to be a clear example of what you are trying to do on the Week Calendar webpage, but I am sure that what you need is to create the calendar without the events, but with a callback defined for adding events; and then in some way fire off the external call.

    0 讨论(0)
  • 2021-02-01 10:06

    "2010-02-11 11:00:00" format works fine to specify time for me (without "T" inside), the key of the solution is to set the "allDay" attribute of an event to empty string.

    0 讨论(0)
  • 2021-02-01 10:11

    the output to echo an event should be in this format:

    $('#calendar').fullCalendar({
      events: [{
        title: 'Awesome Event Title', 
        start: new Date($start_year, $start_month, $start_day),     or   end: new Date(y, m, d),
        end: new Date($end_year, $end_month, $end_day)    or   end: new Date(y, m, d)
      }]
    });
    
    0 讨论(0)
  • 2021-02-01 10:13

    I think your having the same problem as I'm having. I've search the web trying to find out how to setup the DateTime so that the fullCalendar javascript will interpret it correctly. (This page had some good clues to that: http://blog.stevenlevithan.com/archives/date-time-format).

    I posted this on the fullCalendar issues page hoping that the creator or anyone else would shed some light on the subject.

    ====================ISSUE DESCRIPTION====================

    What steps will reproduce the problem?

    1. Fetch events using JSON
    2. use this JSON string:

     

    [{"id":2, "title":"title of 2","start":"2009-11-17T10:00:00" ,"end":"2009-11-17T11:01:00","url":"?eventID=2"}]
    

    What is the expected output? What do you see instead?

    • I expect that the event will show up in the calendar with start time 10:00 and end time 11:01.
    • It show up as an all day event.

    What version of the product are you using? On what operating system?

    • FullCalendar v1.4.1
    • Windows XP

    Please provide any additional information below.

    I am using an aspx page for fetching the calendar events. My guess is that there is something wrong with the format of the JavaScript DateTime object that I'm returning in the JSON and that this is causing the fullcalendar to interpret the events as fullDayEvents. The format that I'm sending in the JSON is: 2009-11-17T11:01:00.

    0 讨论(0)
  • 2021-02-01 10:14

    Hey, I have not used your code above, but in json_events.php the default one, there is "[" in the start of php output and "]" on the end.

    0 讨论(0)
  • 2021-02-01 10:18

    In PHP - JSON:

    $eventsArray['allDay'] = "false"; //doesn't work
    
    $eventsArray['allDay'] = false; //did the trick to have a NON FULL DAY correctly rendered!!
    
    0 讨论(0)
提交回复
热议问题