<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script type="text/javascript"> function check_email() { var email = $("#email").attr("value"); $.post("han.ashx", { Email: email }, function (data) { window.alert(data); }); } $(document).ready(function () { $("#queren").click(function () { check_email(); }); }) </script> </head><body><input type="text" id="email" /> <input id="queren" type="button" value="test" /> </body></html> Han.ashx代码 public void Proce***equest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write(context.Request["Email"]); } public bool IsReusable { get { return false; } } 1、$("#email").attr("value")取得email文本框的值2、要实现jquery ajax 需要在webconfig中添加 <system.web> <compilation debug="true" targetFramework="4.0"/> <httpHandlers> <add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory" validate="false"/> </httpHandlers> </system.web>3、
共同学习,写下你的评论
评论加载中...
作者其他优质文章