码迷,mamicode.com
首页 > 其他好文 > 详细

注册检测

时间:2015-01-07 00:26:23      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

<script src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(function () {
$(‘#txtName‘).blur(function () {
var name = $(this).val();
if (name != "") {
$.post("CheckUserName.ashx", { "name": name }, function (data) {
$(‘#errorMsg‘).text(data);
});
} else {
$(‘#errorMsg‘).text("用户名不能为空");
}
});
});
</script>

<body>
<form id="form1" runat="server">
<div>
用户名:<input name="txtName" id="txtName" /><span id="errorMsg"></span><br />
密码:<input name="txtPwd" /><br />
<input type="submit" value="注册"/>
</div>
</form>
</body>

 

 

public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string name = context.Request["name"];
UserInfoBLL bll = new UserInfoBLL();
UserInfo userInfo = bll.GetOneUserInfoModel(name);
if(userInfo!=null)
{
context.Response.Write("用户名已存在");
}
else
{
context.Response.Write("用户名可用");
}

}

注册检测

标签:

原文地址:http://www.cnblogs.com/bidianqing/p/4207354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!