+ -
当前位置:首页 → 问答吧 → 关于ajax中的传值,能在本页面吗

关于ajax中的传值,能在本页面吗

时间:2010-10-09

来源:互联网

我想实现本页面传值,觉得再写一个空白页很多余,但是不知道怎么写,
这是在aspx页面的js代码我觉得这个部分应该没问题
$.get("Regist.aspx", { sname: $("#username").val(), time: new Date().getMilliseconds() }, function (data) {
  if (data == "no") {
  $("#sname").html("<font color='red'>用户已存在</font>");
  }
  else {
  $("#sname").html("<font color='blue'>用户不存在</font>");
  }
问题应该是cs页面的
 protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  if (Request.QueryString["sname"] != null)
  {
  string TBname = Request.QueryString["sname"].ToString();
  System.Threading.Thread.Sleep(3000);
  if (selectname(TBname))
  {
  //Response.Write("have");
  Response.Write("fdsfds");
  }
  else
  {
  Response.Write("kjhkh");
  }

  Response.End();

  }
  else
  {
  Response.Write("khhhh");
  Response.End();
  }
  }
大家帮我看看在Page_Load事件里应该怎么写,给我一个实例也行

作者: twtfjhhdx   发布时间: 2010-10-09

不行的。

作者: mmm306306   发布时间: 2010-10-09

ajax页面可以请求 一般处理文件。。
或者 请求其他aspx页面。

作者: mmm306306   发布时间: 2010-10-09