复制代码代码如下:
<! 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">
<adal>
<Title> </Title>
<script type = "text / javascript" src = "lib / jquery-1.7.2.min.js"> </ script>
<script type = "text / javascript">
$ (function () {
$ ("# btnsubmit"). Cliquez sur (fonction () {
$ .ajax ({
Type: "Post",
URL: "Handler02.Ashx",
Données: $ ("# frMuseRinfo"). Serialize (),
Succès: fonction (résultat) {
$ ("# msg"). html (résultat);
}
});
retourne false;
});
});
</cript>
</ head>
<body>
<form id = "frMuseRinfo" action = "#">
<ballage>
<tr>
<TD>
姓名
</td>
<TD>
<input type = "text" id = "txsername" name = "txsername" />
</td>
</tr>
<tr>
<TD>
密码
</td>
<TD>
<input type = "mot de passe" id = "txtuserpwd" name = "txtuserpwd" />
</td>
</tr>
<tr>
<td colspan = "2">
<input type = "soumi" id = "btnsubmit" value = "提交" />
</td>
</tr>
</ table>
</ form>
<div id = "msg"> </div>
</docy>
</html>
复制代码代码如下:
/// <résumé>
/// Handler 的摘要说明
/// </summary>
Handler de classe publique02: ihttphandler
{
/// <résumé>
/// 请求处理
/// </summary>
/// <param name = "context"> </ param>
public void processRequest (contexte httpcontext)
{
context.Response.contentType = "Text / Plain";
// 方式 2 (对应表单序列化)
String username = context.request.form ["txsername"]. toString ();
string userpwd = context.request.form ["txtuserpwd"]. toString ();
context.Response.write (string.format ("姓名 : {0} , 密码 : {1}", nom d'utilisateur, userpwd));
context.Response.end ();
}
Bool public isreusable
{
obtenir
{
retourne false;
}
}
}