Javascript refetchevent fullcalendar不工作或不知道在哪里调用

Javascript refetchevent fullcalendar不工作或不知道在哪里调用,javascript,fullcalendar,Javascript,Fullcalendar,我在ajax事件后打电话,但没有得到日历上的任何数据更新: 例如:如果我将日期设置为从10到12,那么在调用refetchevent后,它应该显示从10到12的彩色事件,但它保持在10且不移动 Js代码: $('#calendar').fullCalendar({ //re-initialize the calendar header: h, defaultView: 'month', // change default view with ava

我在ajax事件后打电话,但没有得到日历上的任何数据更新: 例如:如果我将日期设置为从10到12,那么在调用refetchevent后,它应该显示从10到12的彩色事件,但它保持在10且不移动

Js代码:

$('#calendar').fullCalendar({ //re-initialize the calendar
            header: h,
            defaultView: 'month', // change default view with available options from http://arshaw.com/fullcalendar/docs/views/Available_Views/ 
            slotMinutes: 15,
            editable: true,
            droppable: true, // this allows things to be dropped onto the calendar !!!

            drop: function(date, allDay) { // this function is called when something is dropped

                // retrieve the dropped element's stored Event Object
                var originalEventObject = $(this).data('eventObject');
                var drop_d = date.getDate();
                var drop_m = date.getMonth();
                var drop_m = drop_m + 1;
                var drop_y = date.getFullYear();
                var init_zero = "";
                if(drop_d >= 1 && drop_d <= 9) {
                    var init_zero = "0";

                } else {
                    var init_zero = "";

                }
                if(drop_m >= 1 && drop_m <= 9) {
                    var month_zero = "0";

                } else {
                    var month_zero = "";

                }
                var drop_date = init_zero + drop_d + "/" + month_zero + drop_m + "/" + drop_y;
                //alert(originalEventObject.title);
                var caller = "1";
                //alert(drop_date);
                //here add call to the lightbox.....to fill the information....
                $.ajax({
                    url: "vehicle_driver_bookwindow.php",
                    type: "POST",
                    data: {driver_name: originalEventObject.title, dropped_on_date: drop_date, caller_from: caller },
                    success: function(data) {
                        document.getElementById("bookwindow").innerHTML = data;
                        ComponentsPickers.init();
                        $("#a_bookwindow").click();

                    }


                });


                // we need to copy it, so that multiple events don't have a reference to the same object
                var copiedEventObject = $.extend({}, originalEventObject);

                // assign it the date that was reported
                copiedEventObject.start = date;
                copiedEventObject.allDay = allDay;
                copiedEventObject.className = $(this).attr("data-class");

                // render the event on the calendar
                // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
                $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);


                // is the "remove after drop" checkbox checked?
                if ($('#drop-remove').is(':checked')) {
                    // if so, remove the element from the "Draggable Events" list
                    $(this).remove();
                }
            },
            /*eventSources: [

    // your event source
    {
        url: "<?php include 'vehicle_json.php'; ?>", // use the `url` property
    }

    // any other sources...

],*/
        //events: 'vehicle_json.php',
            events: <?php include 'vehicle_json.php'; ?>,
            eventDrop: function(event, delta, revertFunc) {
&它不起作用。有人能告诉我我错过了什么或者我错在哪里吗

我的JSON PHP文件:


问题是脚本中包含了vehicle_json.php文件。而不是包含文件,而是传递url


refetchEvents从所有源重新读取事件并在屏幕上重新渲染,您只需从文件vehicle_json.php传递一个json数据

Hi,如果我使用vehicle_json.php,它就不起作用,如果我确实包含vehicle_json.php,那么它就起作用了,所以有人告诉我哪里出错粘贴json响应,并在控制台上查看ajax是否正确启动
$.ajax({
    url: "save_booking_details.php",
    type: "POST",
    data: {booking_id: bookingid},
    success: function(data){
        //alert(data);
        //location.reload();

        //$('#calendar').fullCalendar('removeEventSource', curSource[0]);
    //$('#calendar').fullCalendar('removeEventSource', curSource[0]);
    $('#calendar').fullCalendar('refetchEvents');
<?php
                  $driver_booking = q("select * from vehicle_driver_booking where vehicle_id = ".$_REQUEST['ch']);
                  $array = array();
                  foreach($driver_booking as $bookings) {
                      $driver = getR("vehicle_driver", $bookings['driver_id']);
                      //return date_time from only....
                      $date_from = date("Y-m-d",$bookings['datetime_from']);
                      $time_from = date("H:i:s",$bookings['datetime_from']);
                      //return date_time to only.....
                      $date_to = date("Y-m-d",$bookings['datetime_to']);
                      $time_to = date("H:i:s",$bookings['datetime_to']);
                      if($bookings['days_option'] == 1) {
                          $start = $date_from."T".$time_from;
                          $array[] = array('id' => $bookings['id'], 'title' => $driver['name'], 'start' => $start, 'allDay' => false);
                      } else {
                          $start = $date_from."T".$time_from;
                          $end = $date_to."T".$time_to;
                          $array[] = array('id' => $bookings['id'], 'title' => $driver['name'], 'start' => $start, 'end' => $end, 'allDay' => false);
                      }

                  }

                  echo json_encode($array);
              ?>
$('#calendar').fullCalendar({
    events: '/vehicle_json.php',//place your relevant url here
});