jquery - jQuery fullcalendar:IE中的事件(作为json feed)和事件(作为函数)问题

标签 jquery grails fullcalendar

我正在使用带有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/

相关文章:

javascript - jQuery 完整日历仅添加月份和日期的事件

javascript - 使用取决于 jQuery Validation 插件

javascript - 单击按钮后更改 .innerHTML

php - Ajax 脚本将 xml 延迟加载到 div 中

grails - 使用动态查找器的并行查询的Grails设计模式

apache-flex - Dojo或与Grails一起弯曲?

css - FullCalendar AgendaWeek 水平改变周标题的颜色

javascript - fullcalendar 在本地主机中运行良好,但在服务器中运行不佳

javascript - 获取 jQuery UI Datepicker 的高度和宽度

javascript - 使用 Asset-Pipeline 插件在 Grails 中创建一个 View 加载特定的 JavaScript