ajax问题
btn.value= "请在提交,请稍等! ";
btn.disabled=true;
var voteNum;
var rbVote=document.forms[0].elements[ "vote "];
for(var i=0;i <rbVote.length;i++)
{
if(rbVote[i].checked){
if(!voteNum)
voteNum=rbVote[i].value;
else
voteNum += ", " + rbVote[i].value;
}
}
if(!voteNum){
alert( "请先选择项目! ");
btn.disabled=false;
btn.value= "投票 ";
return;
}
var option={
parameters: "oper=addVote&id= "+id+ "&type= "+type+ "&vote= "+voteNum+ " ",
method: "get ",
onSuccess:function(transport){
var rp=transport.responseText;
if(rp== "ok "){
alert( "成功,谢谢你的投票! ");
btn.value= "已投票 ";
} else {
alert(rp);
btn.disabled=false;
btn.value= "投票 ";
}
},
onFailure:function(transport){
alert(transport.responseText+ "数据提交失败,请检查网络或重试。 ");
}
}
var request=new Ajax.Request( "ajax.aspx ",option);
return;
Ajax文件中: protected void Page_Load(object sender, EventArgs e)
{
Response.Write( "ok ");
}
这样做返回的是弹出一个框:里边是一堆html,请问是怎么回事?
------解决方案--------------------只保留第一句
<%@ Page Language= "c# " Inherits= "KMS.SubModule.UnitiveDocument.Desktop " CodeFile= "Desktop.aspx.cs " %>
------解决方案--------------------楼上正解