|
<script type="text/Javascript">
function checkuser()
{
var option={
parameters:"userid="+$("userid").value,
method:"post",
onSuccess:function(transport){
var rp=transport.responseText;
if(rp=="true")
{
alert("该用户昵称存在!!");
}
else
{
alert("该用户昵称不存在,请重新输入!!");
}
},
onFailure:function(transport){
alert("数据提交失败,请检查网络或重试。");
}
}
var request=new Ajax.Request("Ajax.ASPx?userid="+escape($("userid").value),option);
}
</script>
昵称:<ASP:TextBox ID="userid" runat="server" Text="" onblur="checkuser()"></ASP:TextBox>
Ajax.ASPx页面代码:
private void Page_Load(object sender, System.EventArgs e)
{
string userid = Request.QueryString["userid"];
string sql = "select userid from blog_user where userid='" + userid + "')";
object o = dbconn.ExecuteScalar(sql);
if (o == null)
Response.Write("false");
else
Response.Write("true");
}
AspNet技术:asp.net AJAX实现无刷新获得数据,转载需保留来源!
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。