最近碰上个问题:在IE浏览中添加tree节点,但是页面不能刷新出新增加的节点,为什么?不停的找问题,使用了N种办法。
1. jsp页面清理缓存;
<%
//缓存清理
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", -10);
response.flushBuffer();
%>
2. ajax方法体内加 cache:false;
$.ajax({
type: "post",
url: contextPathJs + "/configGroup/ConfigGroupController.getGroupDeviceTree",
dataType: "json",
cache: false,
......... 不管用!!! 直到第3种管用了:
管用的办法 :3:url 里面加参数 ran
$.ajax({
type: "post",
url: contextPathJs + "/configGroup/ConfigGroupController.getGroupDeviceTree"+"?ran="+Math.random(),
dataType: "json",
cache: false,
IE浏览器坑,加上随机数才走后台方法,不然直接走缓存。 ok,第3中方法搞定。