我正在使用带有Grails的jQuery fullcalendar。我之前使用的是事件(作为json提要),当用户单击prev / next或更改 View 时,每次都会调用json提要URL。
由于我还需要检查用户 session ,因此我将事件(作为json提要)更改为事件(作为函数),如下所示。问题是它第一次起作用,但是下一次以后,ajax请求没有被发送到服务器,IE从缓存中显示出来。如果清除浏览器缓存,则它将再次从服务器获取它。
所以问题是,IE正在缓存事件对象。我能知道我在做什么错吗?奇怪的是,这在Firefox和Chrome中可以正常工作。
//events: calendarEventsURL
events: function(start, end, callback) {
$.ajax({
url: calendarEventsURL,
data: {
start: Math.round(start.getTime() / 1000),
end: Math.round(end.getTime() / 1000)
},
success: function(msg) {
if(msg == "no-session"){
$("#wait").html(invalidSessionMsg).fadeIn('fast',function(){
$("#wait").fadeOut(2000,function(){
window.location= "/" + $("#appName").val() + "/";
});
});
} else {
var events = [];
for(var c = 0; c < msg.length; c++){
events.push({
id: msg[c].id,
title: msg[c].title,
allDay: false,
start: msg[c].start,
end: msg[c].end
});
}
callback(events);
}
} , error: function(){
$("#wait").html(errorMsg).fadeIn('fast',function(){
});
}
});
}
最佳答案
尝试将缓存属性设置为false:
//events: calendarEventsURL
events: function(start, end, callback) {
$.ajax({
cache: false,
url: calendarEventsURL,
data: {
start: Math.round(start.getTime() / 1000),
end: Math.round(end.getTime() / 1000)
},
success: function(msg) {
if(msg == "no-session"){
$("#wait").html(invalidSessionMsg).fadeIn('fast',function(){
$("#wait").fadeOut(2000,function(){
window.location= "/" + $("#appName").val() + "/";
});
});
} else {
var events = [];
for(var c = 0; c < msg.length; c++){
events.push({
id: msg[c].id,
title: msg[c].title,
allDay: false,
start: msg[c].start,
end: msg[c].end
});
}
callback(events);
}
} , error: function(){
$("#wait").html(errorMsg).fadeIn('fast',function(){
});
}
});
}
关于jquery - jQuery fullcalendar:IE中的事件(作为json feed)和事件(作为函数)问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3960037/