All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
ajax缓存解决123_[AJAX教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/3/16 2:52:58 Browse times: 342 Comment times: 0

ajax缓存解决123_[AJAX教程]


Head photo

Go homepage
Upload pictures
Write articles

ajax缓存解决123_[AJAX教程]

ajax缓存解决有1,2,3种办法:

1、加个随机数 ASP随机函数
xmlHttp.open("GET", "ajax.asp?now=" + new Date().getTime(), true);

2、在要异步获取的asp页面中写一段禁止缓存的代码:
Response.Buffer =True
Response.ExpiresAbsolute =Now() - 1
Response.Expires=0
Response.CacheControl="no-cache"

3、在ajax发送请求前加上xmlHTTP.setRequestHeader("If-Modified-Since","0");可以禁止缓存
xmlHTTP.open("get", URL, true);
xmlHTTP.onreadystatechange = callHTML;
xmlHTTP.setRequestHeader("If-Modified-Since","0");
xmlHTTP.send();





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.