复制代码代码如下:
<! doctype html public "-// w3c // dtd xhtml 1.0 transitional // en"
<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"). انقر فوق (function () {
$ .ajax ({
النوع: "بعد" ،
عنوان URL: "Handler02.Ashx" ،
البيانات: $ ("#frmuserinfo"). Serialize () ،
النجاح: الوظيفة (النتيجة) {
$ ("#msg"). html (نتيجة) ؛
}
}) ؛
العودة كاذبة
}) ؛
}) ؛
</script>
</head>
<body>
<form id = "frmuserInfo" Action = "#">
<griding>
<tr>
<td>
姓名
</td>
<td>
<type type = "text" id = "txtusername" name = "txtusername" />
</td>
</r>
<tr>
<td>
密码
</td>
<td>
<type type = "password" id = "txtuserpwd" name = "txtuserpwd" />
</td>
</r>
<tr>
<td colspan = "2">
<type type = "إرسال" id = "btnsubmit" value = "提交" />
</td>
</r>
</table>
</form>
<div id = "msg"> </viv>
</body>
</html>
复制代码代码如下:
/// <summary>
/// معالج 的摘要说明
/// </summary>
معالج الطبقة العامة 02: ihttphandler
{
/// <summary>
/// 请求处理
/// </summary>
/// <param name = "context"> </param>
Public Void ProcessRequest (سياق httpcontext)
{
context.Response.contentType = "text/plain" ؛
// 方式 2 (对应表单序列化)
username string = context.request.form ["txtusername"]. toString () ؛
string userPwd = context.request.form ["txtuserpwd"]. toString () ؛
context.response.write (string.format (": : : {0} , : : {1}" ، اسم المستخدم ، userPwd)) ؛
context.Response.end () ؛
}
منطقي عام لا يمكن
{
يحصل
{
العودة كاذبة
}
}
}