運用Ajax做了一個名字檢驗,第一次是有效的,但是提交過后,再檢驗一次,結果就不對了,是由于IE的cache的原因。
復制代碼 代碼如下:
function verify() {
$.ajax({
//issue for IE cache; timestamp=" + new Date().getTime()
url:"checkGroupName?timestamp=" + new Date().getTime(),
async: true,
data:"groupName=" + $("#cn").val()+"&groupTypeForDetail="+$("#groupType").val()+"&prefix="+$("#p").val(),
dataType:"html",
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());
$('#subData').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");
}
}
});
}
復制代碼 代碼如下:
header("Expires: 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");
新聞熱點
疑難解答
圖片精選