jQuery的Ajax请求不工作的IE浏览器10(由于高速缓存) [英] Jquery Ajax requests not working on IE 10 (due to cache)

查看:135
本文介绍了jQuery的Ajax请求不工作的IE浏览器10(由于高速缓存)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想首先这一点。我受够了IE浏览器。我有以下code:

I would like to begin with this. I am fed up with IE. I have the code below:

$(function () {
$("#cal").on('click', "#forward", function () {
    $.ajax({
        url: "Home/Calendar?target=forward",
        type: "GET",
        success: function (result) {
            $("#cal").html(result);
        }
    });
  });
});

 $(function () {
$("#cal").on('click', "#backwards", function () {

    $.ajax({
        url: "Home/Calendar?target=backwards",
        type: "GET",
        success: function (result) {
            $("#cal").html(result);
        }
    });
});
});

这是一个Ajax调用在C#MVC应用程序控制器的动作。它只是来回日历月更换HTML。现在我知道,你需要重新安装时,由于 HTML()通话,这就是为什么我用上()使用jQuery 1.7。我已经使用委托()为好。在FF,铬它工作按预期。在IE 10没有。我很茫然。我知道,IE浏览器曾与代表问题IE8和使用jQuery< 1.5但这并非如此。

It is an ajax call to a controller action in an C# MVC application. It just goes back and forth a calendar's months replacing the html. Now I know that you need to reattach the event due to the html() call and that is why I use on() with JQuery 1.7. I have used delegate() as well. In FF, Chrome it works as intended. In IE 10 it does not. I am at a loss. I knew that IE had issues with delegate in IE8 and with JQuery < 1.5 but this is not the case.

有谁知道如何解决此问题?

Does anyone know how to solve this?

推荐答案

我回答这个问题只是为其他人将来参考。似乎IE缓存是出于某种原因,我无法COM prehend AJAX请求。

I am answering the question just for future reference for other people. It seems that IE is caching AJAX requests for some reason I am unable to comprehend.

我注意到使用(出奇的好)开发工具IE 10提供了我得到我的AJAX请求304未修改响应。这不是在Firefox或Chrome的情况下(200是响应)。

I noticed using the (surprisingly good) developer tools IE 10 provides that I was getting a 304 not modified response to my AJAX requests. This was not the case in Firefox or Chrome (200 was the response).

我添加了缓存:假选项,我AXAJ jQuery函数,现在它按预期工作

I added the cache: false option to my AXAJ JQuery functions and now it works as intended.

IE从来没有抓住给我带来惊喜。

IE never seizes to amaze me.

这篇关于jQuery的Ajax请求不工作的IE浏览器10(由于高速缓存)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆