您的位置:首页 > Web前端 > JQuery

jquery 验证用户名(ajax验证用户名是否存在)

2013-09-05 20:23 686 查看
jquery 验证用户名(ajax验证用户名是否存在)下面我们要提供的是一款利用jquery插件来验证用户名哦,这里是利用jquery ajax来验证用户名是否存在哦。jquery 验证用户名(ajax验证用户名是否存在)
下面我们要提供的是一款利用jquery插件来验证用户名哦,这里是利用jquery ajax来验证用户名是否存在哦。

%>
<%@ page language="c#" contenttype="text/html" responseencoding="gb2312" %>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>jquery 验证用户名(ajax验证用户名是否存在)</title>
<script type="text/网页特效" src="css教程/jquery-1.3.2.网页特效"></script>
<script type="text/javascript">
function judgeusername()
{
$.ajax({
type:"get",
url:"www.php100.com.asp教程x",
datatype:"html",
data:"username="+$("#txtname").val(),
beforesend:function(xmlhttprequest)
{
$("#showresult").text("正在查询");
//pause(this,100000);
},
success:function(msg)
{
$("#showresult").html(msg);
$("#showresult").css("color","red");
},
complete:function(xmlhttprequest,textstatus)
{
//隐藏正在查询图片
},
error:function()
{
//错误处理
}
});
}
</script>
</head>
<body>
<div>
<input id="txtname" type="text" /><input type="button" value="查看用户名是否存在" id="btn" onclick="judgeusername();" />
<div id="showresult" style="float:left"></div>
</div>
</body>
</html>
<%
protected void page_load(object sender, eventargs e)
{
string username = request.querystring["username"].tostring ();
if (username == "james hao")
{
response.write ("用户名已经存在!");
}
else
{
response.write ("您可以使用此用户名!");
}
}
/*
异步刷新实现方式有多种,也可以借助js的多种框架,下面是使用jquery框架实现的ajax 验证用户名是否存在
*/
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: