如何防止 jQuery Ajax 请求缓存在 Internet Explorer 中? [英] How to prevent a jQuery Ajax request from caching in Internet Explorer?

查看:35
本文介绍了如何防止 jQuery Ajax 请求缓存在 Internet Explorer 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止 jQuery Ajax 请求在 Internet Explorer 中缓存?

How do I prevent a jQuery Ajax request from caching in Internet Explorer?

推荐答案

您可以使用 <代码>$.ajaxSetup(),例如:

You can disable caching globally using $.ajaxSetup(), for example:

$.ajaxSetup({ cache: false });

这会在发出请求时将时间戳附加到查询字符串.为特定的 $.ajax() 调用关闭缓存, 在本地设置 cache: false ,像这样:

This appends a timestamp to the querystring when making the request. To turn cache off for a particular $.ajax() call, set cache: false on it locally, like this:

$.ajax({
  cache: false,
  //other options...
});

这篇关于如何防止 jQuery Ajax 请求缓存在 Internet Explorer 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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