[英]I have JSON data and I would like to show that on Full Calender
function getMTPForCalendar(){
var data=$('#mtp-form').serialize();
$.ajax({
type :'GET',
dataType: 'json',
data: data,
url : "${pageContext.request.contextPath}/mtp/mtpForCalendar",
success:function(data, textStatus, jqXHR)
{
var eventData=[];
alert(JSON.stringify(data))
for(var i=0;i<data.length;i++){
var source = { events:[
{
title: data[i]['doctorName'],
start: data[i]['plannedDate']
}
]};
$('#calendar').fullCalendar( 'addEventSource', source );
}
},
error: function(jqXHR, textStatus, errorThrown)
{
}
});
the values are coming but the problem is that only 1 event value generated..and after again search the same value arises on that particular date..I think Loop is not proper working..Give me the Appropriate code.. 值即将到来,但问题是仅生成了1个事件值。在再次搜索后,在该特定日期出现了相同的值。我认为Loop无法正常工作。请给我合适的代码。
我认为您应该使用$('#calendar')。fullCalendar('addEvent',event)而不是$('#calendar')。fullCalendar('addEventSource',source),或者在源中设置所有事件,然后在for循环之后添加addEventSource。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.