我正在尝试根据通过 php 从 mysql 中提取的数据预先填充 fullcalendar。但是,该事件并未在完整日历中填充。我的代码是:
function invokeNewCal(elem)
{
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $(elem).fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true
editable: true,
events: {
url: 'index.php?methodname=getevents'
}
});
}
方法是:
function getevents($m,$n)
{
echo json_encode(array('title'=>'Hello','start'=>'Wed, 10 Apr 2013 13:00:00 IST','end'=>'Wed, 10 Apr 2013 17:00:00 IST'));
}
这个 JSON 响应是:
{"title":"Hello","start":"Wed, 10 Apr 2013 13:00:00 IST","end":"Wed, 10 Apr 2013 17:00:00 IST"}
但是,该事件未在 fullCalendar 上显示。知道我错过了什么吗?
谢谢
完整请求/响应:
Request URL:
http://localhost/linkd/index.php?methodname=getevents&start=1364668200&end=1368297000&_=1365120846819
Request Method:
GET
Status Code:
HTTP/1.1 200 OK
Request Headers
05:44:26.000
X-Requested-With:XMLHttpRequestUser-Agent:Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0Referer:http://localhost/linkd/schooladmin.phpHost:localhostConnection:keep-aliveAccept-Language:en-US,en;q=0.5Accept-Encoding:gzip, deflateAccept:application/json, text/javascript, */*; q=0.01
Sent Cookie
PHPSESSID:cs7ai8vreh43q9otaff91kpe67
Response Headers
Δ23ms
X-Powered-By:PHP/5.3.21Server:Apache/2.2.21 (Win32) PHP/5.3.21Keep-Alive:timeout=5, max=99Date:Fri, 05 Apr 2013 00:14:26 GMTContent-Type:text/htmlContent-Length:95Connection:Keep-Alive
Response Body
Δ0ms
{"title":"Hello","start":"Wed, 10 Apr 2013 13:00:00 EST","end":"Wed, 10 Apr 2013 17:00:00 EST"}