2014-11-20 57 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

相关问题