复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transisi // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> </title>
<script type = "text/javascript" src = "lib/jQuery-1.7.2.min.js"> </script>
<type skrip = "Teks/JavaScript">
$ (function () {
$ ("#btnsubmit"). Klik (fungsi () {
$ .Ajax ({
Ketik: "Posting",
URL: "Handler02.ashx",
Data: $ ("#frmuserInfo"). Serialize (),
Sukses: function (hasil) {
$ ("#msg"). html (hasil);
}
});
mengembalikan false;
});
});
</script>
</head>
<body>
<Form id = "frmuserInfo" action = "#">
<able>
<tr>
<td>
姓名
</td>
<td>
<input type = "text" id = "txtusername" name = "txtusername" />
</td>
</tr>
<tr>
<td>
密码
</td>
<td>
<input type = "password" id = "txtuserpwd" name = "txtuserpwd" />
</td>
</tr>
<tr>
<td colspan = "2">
<input type = "kirim" id = "btnsubmit" value = "提交" />
</td>
</tr>
</boable>
</form>
<Div id = "msg"> </div>
</body>
</html>
复制代码代码如下:
/// <summary>
/// Handler 的摘要说明
/// </summary>
Handler kelas publik02: ihttphandler
{
/// <summary>
/// 请求处理
/// </summary>
/// <param name = "context"> </param>
Public Void ProcessRequest (konteks httpcontext)
{
Context.Response.ContentType = "Teks/Polos";
// 方式 2 (对应表单序列化)
String username = context.Request.Form ["txtusername"]. ToString ();
string userpwd = context.Request.Form ["txtUserPwd"]. ToString ();
Context.Response.write (String.Format ("姓名 : {0} , : : {1}", nama pengguna, userpwd));
context.response.end ();
}
BOOL PUBLIK ISREUSABLE
{
mendapatkan
{
mengembalikan false;
}
}
}