2015-02-03 10 views
2

저는 (는) 자바 스크립트와 PHP의 새로운 기능으로 약간의 문제점이 있습니다.캘린더를 만들 때 자바 스크립트 오류가 발생했습니다.

mysql 데이터베이스와 상호 작용하고 일정에 이벤트를 추가하는 자바 스크립트를 작성하려고하는 PHP 달력을 만들려고합니다.

내 이벤트는 mysql 데이터베이스에서 가져 왔지만 캘린더에 이벤트를 추가 할 때마다 콘솔에서 "잡히지 않은 TypeError : 정의되지 않은 함수는 아닙니다"라는 오류 메시지가 표시됩니다. 코드에서 :

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

내 코드가 아래와 같습니다. 콘솔 로그 'testing function success'가 표시되지 않습니다. 도와주세요! 에 의해 권장 http://momentjs.com/docs/#/displaying/format/ 대신 함수의 PARAMS 있습니다

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

사용 (현지 varialbes 시작 재정의하지 않도록주의 선, 끝의

$(document).ready(function() { 
//get current date 
var date = new Date(); 
var d = date.getDate(); 
var m = date.getMonth(); 
var y = date.getFullYear(); 


    var calendar = $('#calendar').fullCalendar({ 
    theme:true, 
    weekNumbers: true, 
    //allow a 'more' option if too many events. 
    eventLimit: true, 
     //enables agenda view 
    header:{ 
      left:'prev,next today', 
      center: 'title', 
      right: 'month,agendaWeek,agendaDay' 
     }, 

    events: 'event.php', 

    selectable: true, 
    selectHelper: true, 
     select: function(start, end, allDay) { 
     console.log('testing function 1'); 
     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: 'eventadd.php', 
     data: 'title='+ title+'&start='+ start +'&end='+ end , 
     type: "POST", 
     success: function(json) { 
     console.log('testing function success'); 
     alert('OK'); 
     } 
     }); 
     calendar.fullCalendar('renderEvent', 
     { 
     title: title, 
     start: start, 
     end: end, 
     allDay: allDay 
     }, 
     true // make the event "stick" 
     ); 
     } 
     calendar.fullCalendar('unselect'); 
     }, 








    }); 

      }); 
+0

그리고 임의의 일정은 무엇입니까? – epascarello

+0

전체 달력처럼 보입니다 ... – reekogi

+0

전체 달력, jquery 플러그인을 사용하고 있습니다 – Student

답변

0

도에 따라 순간의 포맷 기능을 사용하여 fullCalendar V2 코드 마이그레이션) :

var sfmated = start.format("yyyy-MM-dd HH:mm:ss"); 
    var efmated = end.format("yyyy-MM-dd HH:mm:ss"); 

작업 jsfiddle가 여기에 있습니다 :

http://jsfiddle.net/xv5n1wod/12/

+0

감사합니다! 그게 효과가 있었어. – Student

관련 문제