嗨,我想从 div 中删除数据并将新数据重新绑定到该 div。我怎样才能实现这一点。在 div 标签中,我正在显示带有一些事件的完整日历。在这里,我想删除该 div 的数据并将新事件重新绑定到同一个 div 标签
$.ajax({
type: "POST",
contentType: "application/json",
data: dataString,
url: "ViewEvents.aspx/GetState",
dataType: "json",
success: function (data) {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
//select: selectDate,
eventClick: updateEvent,
droppable: false,
draggable: false,
disableDragging: true,
timeFormat: 'H:mm',
selectable: true,
selectHelper: true,
eventTextColor: 'Yellow',
eventBackgroundColor: 'purple',
events:
$.map(data.d, function (item, i) {
// $('#calendar').fullCalendar('addEventSource', item);
var sdate = item.StartDate
var sdatesplit = sdate.split("/");
var sm = sdatesplit[0];
var sm = sm - 1;
var sd = sdatesplit[1];
var sy = sdatesplit[2];
var syearsplit = sy.split(" ");
var edate = item.EndDate;
var edatesplit = edate.split("/");
var em = edatesplit[0];
var em = em - 1;
var ed = edatesplit[1];
var ey = edatesplit[2];
var eyearsplit = ey.split(" ");
var stime = item.EventStarttime;
var stimesplit = stime.split(":");
var etime = item.EventEndtime;
var etimesplit = etime.split(":");
var event = new Object();
event.id = item.EventID;
event.start = new Date(syearsplit[0], sm, sd, stimesplit[0], stimesplit[1]);
event.end = new Date(eyearsplit[0], em, ed, etimesplit[0], etimesplit[1]);
event.title = item.EventName;
event.allDay = false;
return event;
})
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});