简体   繁体   English

Bootstrap FullCalendar未捕获的TypeError:undefined不是函数

[英]Bootstrap FullCalendar Uncaught TypeError: undefined is not a function

I'm working on FullCalendar to make a scheduler. 我正在使用FullCalendar制作调度程序。 I cannot seem to add any events to my mysql database because I get an error: 我似乎无法向我的mysql数据库添加任何事件,因为出现错误:

Uncaught TypeError: undefined is not a function. 未捕获的TypeError:未定义不是函数。

Chrome is highlighting the following line: Chrome浏览器突出显示以下行:

var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");

Any ideas why? 有什么想法吗? I have fullCalendar v 2.1.1. 我有fullCalendar v 2.1.1。 referenced properly. 引用正确。

Here's the full script. 这是完整的脚本。

//do all the calendar stuff for adding a new appt.
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

var calendar = $("#calendar").fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    editable: true,
    slotDuration: '00:10:00',
    defaultView: 'agendaWeek',
    draggable: true,
    events: 'json_appointments.php',
    eventRender: function(event, element, view) {
        if (event.allDay == true) {
         event.allDay = true;
        } else {
         event.allDay = false;
        }
   },
    eventClick:  function(event, jsEvent, view) {
        $('#modalTitle').html(event.title);
        $('#modalBody').html(event.reason + ' ' + event.pre_notes);
        $('#fullCalModal').modal();
    },
     loading: function(bool) { 
        if (bool) $('#loading').show(); 
        else $('#loading').hide(); 
     },
    selectable: true,
    selectHelper: true,
    select: function(start, end, allDay) {
       var title = prompt('Event Title:');
       if (title) {
           var start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
           var end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
           $.ajax({
               url: 'ajax_add_appt.php',
               data: 'title='+ title+'&start='+ start +'&end='+ end,
               type: "POST",
               success: function(json) {
               alert('Added Successfully');
               }
           });
           calendar.fullCalendar('renderEvent',
               {
               title: title,
               start: start,
               end: end,
               allDay: allDay
               },
            true // make the event "stick"
           );
       }

       calendar.fullCalendar('unselect');
   },
   eventDrop: function(event, delta) {
       var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
       var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
       $.ajax({
           url: '',
           data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
           type: "POST",
           success: function(json) {
                alert("Updated Successfully");
           }
       });
    },
   eventResize: function(event) {
       var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
       var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
       $.ajax({
        url: 'http://localhost:8888/fullcalendar/update_events.php',
        data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
        type: "POST",
        success: function(json) {
         alert("Updated Successfully");
        }
       });

    }
});

Thanks for the comments. 感谢您的评论。 I did have moment.js referenced. 我确实引用了moment.js。

I just had to edit my script like this: 我只需要像这样编辑我的脚本:

var start=moment(start).format('YYYY-MM-DDTHH:mm:ssZ'); 
var end=moment(end).format('YYYY-MM-DDTHH:mm:ssZ'); 

... based on the other stack link that Alvaro mentioned. ...基于Alvaro提到的另一个堆栈链接。 Thank you. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Uncaught TypeError:undefined不是具有fullcalendar-rails的函数 - Uncaught TypeError: undefined is not a function with fullcalendar-rails Bootstrap - “未捕获的TypeError:undefined不是函数” - Bootstrap - “Uncaught TypeError: undefined is not a function” 未捕获的TypeError:Undefined不是MVC C#中使用fullcalendar的函数问题 - Uncaught TypeError: Undefined is not a function Issue in MVC C# using fullcalendar Bootstrap .dropdown()“Uncaught TypeError:undefined不是函数” - Bootstrap .dropdown() “Uncaught TypeError: undefined is not a function” Bootstrap Modal JS Uncaught TypeError:未定义不是函数 - Bootstrap Modal JS Uncaught TypeError: undefined is not a function 未捕获的类型错误:$(...).fullCalendar 不是 Laravel 5 中的函数 - Uncaught TypeError: $(...).fullCalendar is not a function in Laravel 5 未捕获的类型错误:回调不是 function FullCalendar - Uncaught TypeError: callback is not a function FullCalendar 为什么未捕获到TypeError:$(...)。fullCalendar不是函数? - Why Uncaught TypeError: $(…).fullCalendar is not a function? 未捕获的类型错误:$(...).fullCalendar 不是 function 错误 - Uncaught TypeError: $(…).fullCalendar is not a function error 未捕获的TypeError:对象不是Fullcalendar中的函数 - Uncaught TypeError: object is not a function in Fullcalendar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM