+ -
当前位置:首页 → 问答吧 → jquery如何用.get获取aspx中的数据啊

jquery如何用.get获取aspx中的数据啊

时间:2010-04-09

来源:互联网

aspx代码
复制代码
  1.  using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. public partial class _Default : System.Web.UI.Page
  8. {
  9.     protected void Page_Load(object sender, EventArgs e)
  10.     {
  11.         string abc = new string(Request.QueryString["test"].ToString());
  12.         uservalidator(abc);
  13.     }
  14.     public void uservalidator(string username)
  15.     {
  16.         this.Response.ContentType = "text/html";
  17.         string readResult = "";
  18.         this.Response.Clear();
  19.         if(username == "abc")
  20.         {
  21.             readResult=username + "已经被注册";
  22.         }
  23.         else
  24.         {
  25.             readResult=username + "可以注册";
  26.         }
  27.         this.Response.Write(readResult);
  28.         this.Response.End();
  29.     }
  30. }


jquery代码
复制代码
  1.  /**
  2.  * @author Administrator
  3.  */
  4. $(document).ready(function(){
  5.  $("#btn_1").click(function(){
  6.   if($("#user_name").val()=="")
  7.   {alert("用户名字不能为空")}
  8.   else
  9.   {
  10.    $.get("http://localhost:1131/Jqueryget/Default.aspx",{Name:$("#user_name").val()},function(data, textstatus){
  11.     $("#result").html(data);
  12.    });
  13.   }
  14.  });
  15.  $("#user_name").keyup(function(){
  16.   if($("#user_name")=="")
  17.   {
  18.    $("#user_name").addClass("userText");
  19.   }
  20.   else
  21.   {
  22.    $("#user_name").removeClass("userText");
  23.   }
  24.  });
  25. })

作者: chinamail   发布时间: 2010-04-09

这样怎么获取不到呢 ??

作者: chinamail   发布时间: 2010-04-09

public partial class _Default : System.Web.UI.Page +,Ihandle 试试

作者: wudao2006   发布时间: 2010-04-14