非同期通信処理のオプションを指定する

書式

formElement.request(option)

formElement : フォームエレメント
option : Ajax.Request()で指定できるオプション

説明

 非同期通信処理のオプションを指定するにはrequest()を使います。パラメータにはAjax.Request()で指定できるオプションを指定できます。

サンプルコード [実行]

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript"><!--
function send(){
$("myForm").request({
onComplete : function(){
alert("通信完了");
},
onSuccess : function(){
alert("正常に処理されました");
}
});
}
// --></script>
</head>
<body>
<h1>非同期通信処理のオプションを指定する</h1>
<form id="myForm" methdo="get" action="./sample.txt">
<input type="button" value="通信処理開始" onClick="send()">
</form>
</body>
</html>