function verify() {
$.ajax({
//issue for IE cache; timest
amp=" + new Date().getTime()
url:"checkGroupName?timestamp=" + new Date().getTime(),
async: true,
data:"groupName=" + $("
#cn").val()+"&am
p;groupTy
PEForDet
ail="+$("#groupType").val()+"&
PRefix="+$("#p").val(),
dataType:"ht
ML",
success:function(data){
if(data
==1){
$("#result").html("<font color='green'>Group name["+$("#p").val()+ $("#cn").val()+"]Valid</font>");
$("#email").val($("#p").val()+ $("#cn").val()+$("#emailHidden").val());
$('#s
ubData').removeAttr("disabled");
}else if(data==2){
$("#result").html("<font color='
red'>Group name["+$("#p").val()+ $("#cn").val()+ "]already existed.</font>");
$('#subData').attr('disabled',"true");
}else{
$("#result").html("<font color='red'>Group name can not be empty.</font>");
$('#subData').attr('disabled',"true");
}
}
});
}
Firefox 每次 request 都会重新再回一次 server 取得最新的数据,但是 IE 就不一样了,它会 cache 住之前得到的数据,只有第一次 request 时会真正的去 server 读取数据,导致ajax数据不会随时
更新….
header("E
xpires: Sat, 1 Jan 2005 00:00:00 GMT");
header("Last-Modified: ".
gmdate( "D, d M Y H:i:s")."GMT");
header("cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
方法和第三种类似,在 URL 参数后加上 "?timestamp=" + new Date().getTime(); //推荐使用这种方式,我用的就是这种,个人认为比较方便。