帮你找了一个javascript原生代码与ashx的示例,你参考下
http://hi.baidu.com/kezhong890623/item/9d08660c56457f133b53ee3f
另外:jquery+ashx示例
.ashx文件
<%@ WebHandler Language="C#" class="CheckUser" %>
using System;using System.Web;
public class CheckUser : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write(UserRule.GetInstance().IsUserExist(context.Request["Email"]));
}
public bool IsReusable
{
get {
return false;
}
}
}
html:
<input type="text" id="email" />
<input type="button" value="test" onclick="check_email()" />
js:
function check_email()
{
var email = $("#email").attr("value");
$.get("../ajax/checkuser.ashx",
{ Email: email },
function(data)
{
window.alert(data);
});
}
登陆的时候用ajax去访问就可以了啊
详细说一下代码