jquery练习3笔记
<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 ProcessRequest(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、
作者“技术学习笔记”
相关新闻>>
- 发表评论
-
- 最新评论 更多>>