2014-11-20 34 views
0

Ajax調用的函數我有一個fullcalendar我的應用程序工作,我增加了以下方法,通過用戶對搜索結果進行過濾:遺漏的類型錯誤:布爾是不是在fullcalendar

function filter_by_provider(selected_provider) { 
    $('#calendar').fullCalendar('removeEvents'); 
    $('#calendar').fullCalendar('addEventSource', function(start, end, callback) { 
       $.getJSON(source, function(data){ 
        var eventsToShow = []; 
        for(var i=0; i<data.length; i++){ 
         if(data[i].provider == selected_provider || selected_provider == ""){ 
          eventsToShow.push(data[i]); 
         }; 
        }; 
        callback(eventsToShow); //here's the Error 
       }); 
      }); 
}; 

的事情是回調似乎不正在工作,我不斷收到此錯誤在該行:

Uncaught TypeError: boolean is not a function 

難道是jQuery的安裝不正確?我錯過了什麼嗎?

我很感激任何幫助。提前致謝。

+0

類型的輸出是什麼,如果你'執行console.log(回調)'? – ptd 2014-11-20 20:17:55

+0

Hi @ptd。這是假的。 – ntonnelier 2014-11-20 20:21:32

回答

1

嘗試:

$('#calendar').fullCalendar('addEventSource', function(start, end, timezone, callback) { 

它在docs

timezone is a string/boolean describing the calendar's current timezone. It is the exact value of the timezone option.

+0

就是這樣。謝啦。 – ntonnelier 2014-11-20 20:27:25

0

檢查回調對象,它看起來像你的回調= true或false

相關問題