jQuery的AJAX不刷新在IE页面 [英] Jquery AJAX not refreshing pages in ie

查看:211
本文介绍了jQuery的AJAX不刷新在IE页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用jQuery的AJAX POST方法来更新DOM的ASP.Net应用程序。

I have an ASP.Net application that uses jQuery's AJAX POST method to update the DOM.

  1. 在用户输入一个日期
  2. 在用户点击一个链接按钮
  3. JQuery的AJAX调用后对数据库加载请求的数据一个div。

一切工作正常,除非用户手动刷新IE浏览器的页面。
如果他们做出改变,然后打浏览器的刷新按钮,然后按照这三个步骤再次,它并不表明他们刚刚进入,即使数据库已被正确更新的更新数据。

Everything works fine, unless the user manually refreshes the page in IE.
If they make a change then hit the browser refresh button, then follow those three steps again, it doesn't show the updated data that they just entered even though the database has been properly updated.

这说明在原始数据

他们必须完全关闭浏览器,然后重新打开它看到的变化。

They have to close the browser altogether and re-open it to see the changes.

这只是发生在IE浏览器。
FF和Chrome显示更改,如果他们刷新。

This only happens in IE.
FF and Chrome show the changes if they refresh.

我是什么在这里失踪?

推荐答案

Internet Explorer的缓存AJAX请求的URL,并会简单地返回缓存的响应,当您再次AJAX调用同一网址。值得庆幸的是,在一个jQuery AJAX调用设置缓存选项将导致时间戳被附加到URL,绕过缓存。

Internet Explorer caches AJAX requests to URLs, and will simply return the cached response when you make another AJAX call to that same URL. Thankfully, setting the cache option on a jQuery AJAX call to false will result in a timestamp being appended to the URL, bypassing the caching.

要为所有的jQuery Ajax请求,你可以使用 $设置选项。 ajaxSetup() 功能如下所示:

To set that option for ALL jQuery AJAX requests you can use the $.ajaxSetup() function like so:

$.ajaxSetup({cache : false});

把,在你的.js文件的顶部,这样它之前的任何AJAX请求执行。

Put that at the top of your .js file so that it's executed prior to any AJAX requests.

这篇关于jQuery的AJAX不刷新在IE页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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