我正在使用 jQuery fullcalendar 插件,我尝试过很多不同的方式来改变其他问题的答案,但没有运气,这是我的 jQuery:
$(document).ready(function () {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
theme: true,
aspectRatio: 3,
height: 1000,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: function (start, end, callback) {
$.ajax({
type: "POST",
url: "Default.aspx/GetEvents",
data: "{'userID':" + "'B473795D-306A-4718-804B-2813884D5B48'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (doc) {
var events = [];
var obj = $.parseJSON(doc.d);
var res = unescape(obj);
$(res).find('event').each(function () {
events.push({
title: $(this).attr('title'),
start: $(this).attr('start') // will be parsed
});
});
callback(events);
}
});
}
});
});
这是我的回应:
{"d":"[{ \"title\" : \"circleJerk\", \"start\" : \"2012-06-22\" }, { \"title\" : \"BangTheWife\", \"start\" : \"2012-06-15\" , \"end\" : \"2012-06-23\" } ]"}