I've been trying to get events
as an array for FullCalendar with ajax. Object array comes from back-end and i push the data in an array. But events doesn't show and there is no error. Interesting thing is; if i use break point on return array; line or $('#calendar').fullCalendar({ line(please check it out) then push continue, it works. I don't know what's going on. So i need some help. Here is my code:
$(document).ready(function () {
var eventArray = [];
eventArray = GetEvents();
$('#calendar').fullCalendar({
weekends: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay,listMonth'
},
eventSources:
[{
events:eventArray,
color: 'blue'
}]
});
});
function GetEvents()
{
var array = [];
$.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json',
url: 'Schedule.aspx/GetAuditDates',
data: '{}',
success: function (result) {
$.each(result.d, function (k, v) {
array.push({ start: v.start ,title: v.title });
});
}
});
return array;
}
Thanks in advance.