ajax返回状态成功 但是数据没有更新?
<SCRIPT language=javascript>var XMLHttpReq=false;
//创建一个XMLHttpRequest对象
function createXMLHttpRequest(){
if(window.XMLHttpRequest){ //Mozilla
XMLHttpReq=new XMLHttpRequest();
}
else if(window.ActiveXObject){
try{
XMLHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
XMLHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
//发送请求函数
function send(url){
createXMLHttpRequest();
XMLHttpReq.open("GET",url,true);
XMLHttpReq.onreadystatechange=proce; //指定响应的函数
XMLHttpReq.send(null); //发送请求
}
function proce(){
if(XMLHttpReq.readyState==4){ //对象状态
if(XMLHttpReq.status==200){//信息已成功返回,开始处理信息
alert("投票成功");
}
else{
window.alert("所请求的页面有异常");
}
}
}
function checkselect()
{
var checkNum=0;
var num=0;
var obj=document.getElementsByTagName("input");
for(i=0;i<obj.length;i++)
{
if(obj[i].type=="radio" && obj[i].name.indexOf("votes")!=-1 && obj[i].checked)
{
num=obj[i].value;
checkNum++;
break;
}
}
//alert(checkNum==0?"没有选择":"有选择")
if(checkNum >"0")
{
//如果有选中的话则调用创建ajax实例的autoComplete()meth
//参数为你要传入到处理页面checkvote.asp的投票数
//将值赋值给隐藏域
alert(num);
send("checkvote.asp?flvid=" + <%=SafeRequest("flvid")%> + "&votes="+num+"&t=" + new Date().getTime());
}
else
{
alert("请选择你要投的票数");
}
}
</SCRIPT>
下面是 form
<form id="form1" name="form1" method="post" action="checkvote.asp">
<table width="492" border="0" align="center">
<tr>
<td width="90" align="center" valign="middle"><input type="radio" name="votes" id="votes5" value="5" />
<input type="image" name="imageField" id="imageField" src="styles/images/vote/vote_5.gif" />
</td>
<td width="90" align="center" valign="middle"><input type="radio" name="votes" id="votes4" value="4" />
<input type="image" name="imageField2" id="imageField2" src="styles/images/vote/vote_4.gif" />
</td>
<td width="90" align="center" valign="middle"><input type="radio" name="votes" id="votes3" value="3" />
<input type="image" name="imageField3" id="imageField3" src="styles/images/vote/vote_3.gif" />
</td>
<td width="90" align="center" valign="middle"><input type="radio" name="votes" id="votes2" value="2" />
<input type="image" name="imageField4" id="imageField4" src="styles/images/vote/vote_2.gif" />
</td>
<td width="90" align="center" valign="middle"><input type="radio" name="votes" id="votes1" value="1" />
<input type="image" name="imageField5" id="imageField5" src="styles/images/vote/vote_1.gif" />
<input name="flvid" type="hidden" value="5" id="flvid"/>
</td>
<td width="42" align="center" valign="middle"><input type="button" name="button" id="button" value="投票" onClick="return checkselect()"/>
<input type="hidden" name="num1" id="num1" value="" />
</td>
</tr>
</table>
</form>