调用prototype.js的ajax进行post提交示例源码

<%@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 onclick="postNewContact();" name="pbut" type="button" value="POST" />
</form>
</body>
</html>


以下是test2.asp:
<%=request("act")%>

你可能感兴趣的:(prototype)