Jay*_*ran 0 jquery grails fullcalendar
我正在使用带有Grails的jQuery fullcalendar.我之前使用事件(作为json提要),当用户单击prev/next或更改视图时,每次调用json提要URL.
由于我还需要检查用户会话,因此我将事件(作为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(){
});
}
});
}
Run Code Online (Sandbox Code Playgroud)
尝试将cache属性设置为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(){
});
}
});
}
Run Code Online (Sandbox Code Playgroud)