复制代码代码如下:
<! 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>
<title> </title>
<script type = "text/javascript" src = "lib/jQuery-1.7.2.min.js"> </script>
<script type = "text/javascript">
$ (function () {
$ ("#btnsubmit") คลิก (ฟังก์ชัน () {
$ .ajax ({
ประเภท: "โพสต์",
URL: "handler02.ashx"
ข้อมูล: $ ("#frmuserinfo"). serialize (),
ความสำเร็จ: ฟังก์ชั่น (ผลลัพธ์) {
$ ("#msg"). html (ผลลัพธ์);
-
-
กลับเท็จ;
-
-
</script>
</head>
<body>
<form id = "frmuserinfo" action = "#">
<table>
<tr>
<td>
姓名
</td>
<td>
<อินพุต type = "text" id = "txtusername" name = "txtusername" />>>
</td>
</tr>
<tr>
<td>
密码
</td>
<td>
<อินพุต type = "รหัสผ่าน" id = "txtuserpwd" name = "txtuserpwd" />
</td>
</tr>
<tr>
<td colspan = "2">
<input type = "subment" id = "btnsubmit" value = "提交" />
</td>
</tr>
</table>
</form>
<div id = "msg"> </div>
</body>
</html>
复制代码代码如下:
/// <summary>
/// Handler 的摘要说明
/// </summary>
Public Class Handler02: ihttphandler
-
/// <summary>
/// 请求处理
/// </summary>
/// <param name = "บริบท"> </param>
โมฆะสาธารณะ ProcessRequest (บริบท httpContext)
-
context.response.contentType = "ข้อความ/ธรรมดา";
// 方式 2 (对应表单序列化)
string username = context.request.form ["txtusername"]. toString ();
string userpwd = context.request.form ["txtuserpwd"]. toString ();
context.response.write (string.format ("姓名: {0}, 密码: {1}", ชื่อผู้ใช้, userpwd));
Context.response.end ();
-
บูลสาธารณะไม่สามารถใช้งานได้
-
รับ
-
กลับเท็จ;
-
-
-