FullCalendar无法从JSON加载,除了Chrome [英] FullCalendar not loading from JSON except in Chrome

查看:120
本文介绍了FullCalendar无法从JSON加载,除了Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FullCalendar进行剧场排练计划,并决定JSON是从我的MySQL数据库中提取事件的最佳方式。在日历页面的JavaScript中,我在做:

I am using FullCalendar to make a theater-rehearsal schedule, and decided JSON was the best way to pull events from my MySQL database. In the JavaScript for the calendar page, I'm doing:

$(document).ready(function() {
$('#calendar').fullCalendar({
events: '/eventsfeed.php',
[...]

然后我的JSON提要返回了这个,头文件是Content-type:application / json:

And my JSON feed is returning this, with the header "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提要,如果在检索JSON提要时AJAX失败,则会引发alert(),但它从来没有做过任何事情。我检查了浏览器中启用了Javascript,并且试图将JSON提要的内容类型更改为text / html和text / plain,但仍然没有运气。我在这里错过了什么?感谢!

Now, this works just fine in Chrome, but none of my events show up in Firefox or Safari, and they used to show up when I was adding the events as a Javascript array. I tried declaring the JSON feed in a way where an alert() would be thrown if AJAX failed while retrieving the JSON feed, but it never did anything. I checked that Javascript is enabled in the browsers, and I tried changing the JSON feed's content-type to text/html and text/plain, but still had no luck. What am I missing here? Thanks!

推荐答案

这篇关于FullCalendar无法从JSON加载,除了Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆