AJAX防止页面缓存的代码

在希望的田野上,我们看到了希望,看到了未来,看到了祖国未来繁荣昌盛的景象。
采用AJAX技术的时候通常我们无刷新页面提交数据后用同样的url去获取数据的时候会发现是以前的数据~那样就给client端带来假象了~~采用以下的方法可以取消缓存
htm网页
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache,must-revalidate">
<metahttp-equiv="expires"content="wed,26feb199708:21:57gmt">
或者<metahttp-equiv="expires"content="0">
asp网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp网页
response.addHeader("pragma","no-cache");
response.addHeader("cache-control","no-cache,must-revalidate");
response.addHeader("expires","0");

以上就是AJAX防止页面缓存的代码。一念执,千样苦楚来。更多关于AJAX防止页面缓存的代码请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
实现AJAX异步调用和局部刷新的基本步骤

Ajax实现上传图像功能的示例详解

Ajax校验用户名是否存在的方法

AJAX请求数据及实现跨域的三种方法详解

ajax接口文档url路径的简写实例