我正在使用FullCalendar制作剧院排练时间表,并决定JSON是从我的MySQL数据库中提取事件的最佳方式。在日历页面的JavaScript中,我正在做:
$(document).ready(function() {
$('#calendar').fullCalendar({
events: '/eventsfeed.php',
[...]
我的JSON Feed正在返回此标题,标题为“Content-type:application / json”:
[
{
"title" : "First Show",
"start" : "2012-04-26 19:00:00 EST",
"end" : "2012-04-26 21:00:00 EST",
"allDay" : 0,
"comments" : "Good show everyone!",
"scenes" : "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50",
"id" : "1",
"location" : "place",
"userid" : "1"
},
{
"title" : "derp",
"start" : "2012-01-21 13:59:59 EST",
"end" : "2012-01-21 23:59:59 EST",
"allDay" : 0,
"comments" : "test event",
"scenes" : "1,16,24",
"id" : "2",
"location" : "narnia",
"userid" : "1"
}
]
现在,这在Chrome中运行得很好,但我的所有事件都没有出现在Firefox或Safari中,而且我们在将事件添加为Javascript数组时会出现这些事件。我尝试以一种方式声明JSON提要,如果AJAX在检索JSON提要时失败,则会抛出alert(),但它从未做过任何事情。我检查了浏览器中是否启用了Javascript,我尝试将JSON提要的内容类型更改为text / html和text / plain,但仍然没有运气。我在这里错过了什么?谢谢!
答案 0 :(得分:1)