register.aspx页面代码:
<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");
}
标签:
asp.net,AJAX,无刷新

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“asp.net AJAX实现无刷新获得数据”

暂无“asp.net AJAX实现无刷新获得数据”评论...