I want to add an EventSource of an Array. i created a String over an ajax callthat looks like this:
Public Shared Function Test() As String
Dim EventArray As New ArrayList
Dim EventSource As String = "[{"
EventSource += "title: 'All Day Event',"
EventSource += "start: '2012-07-01'"
EventSource += "},"
EventSource += "{"
EventSource += "title: 'Long Event',"
EventSource += "start: '2012-07-25',"
EventSource += "end: '2012-07-28'"
EventSource += "},"
EventSource += "{"
EventSource += "id: 999,"
EventSource += "title: 'Repeating Event',"
EventSource += "start: '2012-07-27 16:00:00',"
EventSource += "allDay: false"
EventSource += "},"
EventSource += "{"
EventSource += "id: 999,"
EventSource += "title: 'Repeating Event',"
EventSource += "start: '2012-08-04 16:00:00',"
EventSource += "allDay: false"
EventSource += "},"
EventSource += "{"
EventSource += "title: 'Meeting',"
EventSource += "start: '2012-07-30 10:30:00',"
EventSource += "allDay: false"
EventSource += "},"
EventSource += "{"
EventSource += "title: 'Lunch',"
EventSource += "start: '2012-07-30 12:00:00',"
EventSource += "end: '2012-07-30 14:00:00',"
EventSource += "allDay: false"
EventSource += "},"
EventSource += "{"
EventSource += "title: 'Birthday Party',"
EventSource += "start: '2012-07-31 19:00:00',"
EventSource += "end: '2012-07-31 22:30:00',"
EventSource += "allDay: false"
EventSource += "},"
EventSource += "{"
EventSource += "title: 'Click for Google',"
EventSource += "start: '2012-07-28',"
EventSource += "end: '2012-07-29',"
EventSource += "url: 'http://google.com/'"
EventSource += "}]"
Return EventSource
End Function
and I tried to add the Array like this:
$(document).ready(function() {
$('#calendar').fullCalendar({
dayClick: function(date) {
alert(date);
},
editable: true
});
$.ajax({
type: 'POST',
url: 'KalenderEvents.aspx/Test',
data: '{}',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (msg) {
var events = msg.d || []
$('#calendar').fullCalendar('addEventSource','events:' + events);
$('#calendar').fullCalendar('rerenderEvents');
}
});
});
If i remove 'events:' the code trys to execute an JSON Feed... else he just don't show anything. ajax call get executed normally.
You don't need to use events:
in the addEventSource
. FullCalendar should accept a JSON array properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.