1、请求页面AJax.aspx
HTML代码
<div>
<input id=\"txtName\" type=\"text\" /><input type=\"button\" value=\"查看用户名是否存在\" id=\"btn\" =\"JudgeUserName();\" />
<div id=\"showResult\" style=\"float:left\">div>
div>
JS代码
< type=\"text/ \" src=\"CSS/jquery-1.3.2.js\"></ >
< type=\"text/ \">
function JudgeUserName()
{
$.ajax({
type:\"GET\",
url:\"AjaxUserInfoModify.aspx\",
dataType:\"html\",
data:\"userName=\"+$(\"#txtName\").val(),
beforeSend:function( HttpRequest)
{
$(\"#showResult\").text(\"正在查询\");
//Pause(this,100000);
},
success:function(msg)
{
$(\"#showResult\").html(msg);
$(\"#showResult\").css(\"color\",\"red\");
},
complete:function( HttpRequest,textStatus)
{
//隐藏正在查询图片
},
error:function()
{
//错误处理
}
});
}
</ >
2 、页面AjaxUserInfoModify.aspx
后台代码
protected void Page_Load( sender, EventArgs e)
{
string userName = Request.QueryString[\"userName\"].ToString ();
if (userName == \"James Hao\")
{
Response.Write (\"用户名已经存在!\");
}
else
{
Response.Write (\"您可以使用此用户名!\");
}
} 继续阅读与本文标签相同的文章
上一篇 :
量子力学的核心:薛定谔方程,究竟神奇在哪里?
下一篇 :
Apple 服务器大面积宕机约38分钟
-
手机导航是怎样判断路况的?不仅是通过卫星,这几个原因使导航更智能
2026-05-14栏目: 教程
-
手机信号突然从“4G”变成“E”,是什么意思?客服给出答案
2026-05-14栏目: 教程
-
互联网架起“乌镇式生活”
2026-05-14栏目: 教程
-
微信才是内存“杀手”,别再乱清理,关闭这个功能,手机立马流畅
2026-05-14栏目: 教程
-
手机信号变成E是什么意思?看完专业人士给出的解释后,涨知识了
2026-05-14栏目: 教程
