我不認爲你可以更新的Response.Write()方法fullcalendar事件的JavaScript對象。
您應該使用ajax在服務器端保存事件並更新客戶端的日曆。 做這樣的事情
function saveEvent() {
var event = { startDate: $('#txtDate').val(), description: $('#txtDescription').val(), id: id }
$.ajax({
type: "POST",
async: false,
url: "../UserCalendarService.asmx/SaveEvent",
data: "{'startDate': '" + event.startDate + "','description':'" + event.description + "','id':'" + event.id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
result = result.d;
eventFound = $('#calendar').fullCalendar('clientEvents', result.id).length;
if (eventFound == 1) {
existingEvent = $('#calendar').fullCalendar('clientEvents', result.id);
existingEvent[0].title = result.title;
existingEvent[0].start = result.start;
existingEvent[0].editable = result.editable;
existingEvent[0].allday = true;
$('#calendar').fullCalendar('updateEvent', existingEvent[0]);
}
else {
$('#calendar').fullCalendar('renderEvent', {
title: result.title,
start: result.start,
id: result.id,
editable: result.editable,
allday: true
},
false // make the event "stick"
);
}
},
error: function (xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
if (err.Message == 'SomeErrorMessage') {
//handleError, redirect or popup message
}
}
});
}
關於你的第二個問題,事件對象有可編輯的屬性。這是真的或假的。 你可以在適當的documentation找到更多關於它的信息。
謝謝你的回覆!好吧,我明白髮生了什麼,但你也可以發佈服務器端代碼?即.asmx文件的內容.. – anuguy 2011-06-03 12:11:33
它只是一個Web服務,它返回來自服務器的事件對象列表(列表),注意到它的特殊性 –
nemke
2011-06-04 06:02:55