2013-04-16 34 views
2

我FullCalendar的jQuery看起来是这样的:jQuery的FullCalendar不解析JSON

$(document).ready(function() { 

$('#calendar').fullCalendar({ 

    events: { 
     url: '/admin/index.php', 
     type: 'GET', 
     data: { 
      m: '1', 
      e: 'fetchCalEvents' 
     }, 
     error: function() { 
      alert('there was an error while fetching events!'); 
     }, 
     color: 'yellow', 
     textColor: 'black' 
    } 

}); 

如果我打的测试网址:

http://localhost/admin/index.php?m=1&e=fetchCalEvents 

我得到好看的JSON:

[{"id":"13","title":"Test Entry","start":"2013-04-20 04:20:00","end":"2013-04-20 05:20:00","url":"#","allDay":false}] 

但加重日历只会弹出:

There was an error while fetching events! 

这并没有告诉我很多。有什么方法可以在这个插件上获得更好的错误处理吗?我没有看到文档中的任何内容。任何想法有什么不对?

:(

回答

0

的问题是,我是通过一个控制器指挥Ajax调用该插件开始工作当我将日历的控制器代码解开后,将其放入与日历加载相同的目录中的独立脚本中。:/远非理想,但我很匆忙。:(:(你好)

0

尝试用这种Solution

看到该文档,官方可能找到回答您的问题