我有一个包含JSP中对象的arraylist的JSON字符串 .
values=gson.toJson(list);%>
<input type="hidden" id="var1" value='<%=values%>'>
'values'中的JSON字符串根据fullcalendar格式化为正确的名称
[{“title”:“Aaron at 101”,“start”:“2016-11-30”,“end”:“2016-12-05”},{“title”:“Dave at 103”,“start” “:” 2016年11月25" 日, “结束”: “2016年12月3日”}]
当我尝试在fullcalendar中使用此变量时,我只看到一个空日历 .
$(document).ready(function() {
var lists= $('#var1').val();
$('#calendar').fullCalendar({
defaultDate: '2016-12-01',
editable: true,
eventLimit: true,
events: lists
});
});
是否有适当的方式来分配事件?请帮帮我,因为我是jQuery的新手 .
1 回答
你是否添加了moment.js依赖?
Bellow我根据你的例子写了一个工作片段 .