fullcalendar通过Json获取事件
我的fullCalendar对象中的事件未显示有问题 我有这个JavaScriptfullcalendar通过Json获取事件,json,fullcalendar,Json,Fullcalendar,我的fullCalendar对象中的事件未显示有问题 我有这个JavaScript $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, eventSources: ["api/apiCalend
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
eventSources: ["api/apiCalendar"],
loading: function (bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
我使用asp.NETMVC4,WebAPI来获取JSON
public HttpResponseMessage Get(string start, string end)
{
calEvent e = new calEvent();
e.id = 1;
e.allDay = true;
e.end = DateTime.Now;
e.start = DateTime.Now.AddHours(-2);
e.title = "Test";
string json = JsonConvert.SerializeObject(e);
return new HttpResponseMessage()
{
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
};
}
此方法返回:{“title”:“Test”,“allDay”:true,“start”:“2012-07-30T21:45:00.8461321+02:00”,“end”:“2012-07-30T23:45:00.8461321+02:00”,“url”:null,“id”:1}
当我尝试直接在事件上设置此JSON字符串时,如下所示:
$('#calendar')......
events: [{"title":"Test","allDay":true,"start":"2012-07-30T21:45:00.8461321+02:00","end":"2012-07-30T23:45:00.8461321+02:00","url":null,"id":1}],
事件进展顺利
但是当尝试从web方法获取时,没有显示任何内容。调试时没有错误或任何看起来错误的东西
我使用插件的最新版本。经过更多研究,解决方案就在这里 asp.net的问题与本文指出的相同