---
title: "调用prototype.js的ajax进行post提交示例源码"
author: "txf2004"
date: "2009-01-15T18:15:00Z"
tags: []
slug: "prototype-js-ajax-post"
draft: false
lastmod: "2009-09-19T07:45:53Z"
id: 471257
url: "https://txf2004.iteye.com/blog/471257"
---

&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%&gt;  
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;  
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;  
&lt;head&gt;  
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;  
&lt;title&gt;PROTOTYPE POST&lt;/title&gt;  
&lt;script language="javascript" type="text/javascript" src="/script/prototype.js"&gt;&lt;/script&gt;  
&lt;/head&gt;  
&lt;body&gt;  
&lt;script type="text/javascript"&gt;  
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);  
}  
&lt;/script&gt;  
&lt;form method="post" id="form" name="form"&gt;  
&lt;input type="text" name="act"&gt;  
&lt;input onclick="postNewContact();" name="pbut" type="button" value="POST" /&gt;  
&lt;/form&gt;  
&lt;/body&gt;  
&lt;/html&gt;

以下是test2.asp：  
&lt;%=request("act")%&gt;