【发布时间】:2014-02-14 09:15:33
【问题描述】:
我正在使用 FullCalendar 制定剧院排练时间表,并认为 JSON 是从我的 MySQL 数据库中提取事件的最佳方式。在日历页面的 JavaScript 中,我正在做:
$(document).ready(function() {
$('#calendar').fullCalendar({
events: '/eventsfeed.php',
[...]
我的 JSON 提要返回这个,标题为“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 失败时会抛出 alert() 的方式声明 JSON 提要,但它从未执行任何操作。我检查了浏览器中是否启用了 Javascript,并尝试将 JSON 提要的内容类型更改为 text/html 和 text/plain,但仍然没有运气。我在这里想念什么?谢谢!
【问题讨论】:
-
啊,我找到了,日期中的 EST 打破了一切。 FullCalendar 的文档说没问题,但我想这是错误的。
-
您可以发布自己的解决方案作为答案并将其标记为已接受。
标签: javascript jquery ajax json fullcalendar