以下是index.html:
<%LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PROTOTYPE POST</title>
<script language="javascript" type="text/javascript" src="/script/prototype.js"></script>
</head>
<body>
<script type="text/javascript">
function postNewContact(){
var form = $(’form’);
var name = $(’act’);
var url = ’test2.asp’;
var myAjax = new Ajax.Request(url,{method:’post’,
parameters: Form.serialize(form),
onComplete:showResponse});
}
function showResponse(originalRequest){
alert(originalRequest.responseText);
}
</script>
<form method="post" id="form" name="form">
<input type="text" name="act">
<input name="pbut" type="button" value="POST" />
</form>
</body>
</html>
以下是test2.asp:
<%=request("act")%>
打开index.html后,在文本框输入字符,点击POST按钮,就可以看到提交后正确返回的效果.