<div class="codetitle"> <span><a style="CURSOR: pointer" data="89225" class="copybut" id="copybut89225" onclick="doCopy('code89225')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code89225"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <br> <br><title></title> <br><script type="text/javascript" src="lib/jquery-1.7.2.min.js"></script> <br><script type="text/javascript"> <br>$(function () { <br>$("#btnSubmit").click(function () { <br>$.ajax({ <br>type: "post", <br>url: "Handler02 .ashx", <br>データ: $("#frmUserInfo").serialize(), <br>成功: 関数 (結果) { <br>$("#msg").html(結果); <br> <br>}); <br><br><br>}); <br></script> <br></head> <br> <br><form id="frmUserInfo" action="#"> <br> <br><tr> <br><td> <br>姓 <br></td> <br> </td> <td> <br><input type="text" id="txtUserName" name="txtUserName" /> <br></td> <br></tr> <br> </td> </tr> <tr> <br><td> <br>秘密 <br></td> <br> </td> <td> <br><input type="password" id="txtUserPwd" name="txtUserPwd" />; <br></td> <br></tr> <br> </td> </tr> <tr> <br><tdcolspan="2"> <br><input type="submit" id="btnSubmit" value="提交" /> <br></td> <br></tr> <br></table> <br></form> <br><div id="msg"></div> <br></body> <br></html> <br><br> <br><div class="codetitle"><span><a style="CURSOR: pointer" data="80939" class="copybut" id="copybut80939" onclick="doCopy('code80939')">复制代<u></u></a>代码如下:</span></div> <div class="codebody" id="code80939">/// <summary> ; <BR>/// ハンドラーの要旨説明 <BR>/// </summary> <br>public class Handler02 : IHttpHandler <br>{ <br>/// <summary> <br>/// 请求处理 <br>/// </summary> <br>/// <param name="context"></param> <br>public void ProcessRequest(HttpContext context) <br>{ <br>context.Response.ContentType = "text/plain"; <br><br>// 方式 2(对应表单序列化) <br>string userName = context.Request.Form["txtUserName"].ToString(); <br>string userPwd = context.Request.Form["txtUserPwd"].ToString(); <br><br>context.Response.Write(string.Format("姓名:{0},秘密:{1}", userName, userPwd)); <br>context.Response.End(); <br>} <br><br>public bool IsReusable <br>{ <br>get <br>{ <br>return false; <br>} <br>} <br>} <br><br> </div> </tr> </div>