zoukankan      html  css  js  c++  java
  • Ajax传个对象传不成功!不知道错了那里!

    Ajax传个对象传不成功!不知道错了那里!有空再研究。。。
     protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(
    typeof(AjaxDemo));
        }

        [AjaxPro.AjaxMethod()]
        
    public string GetStr()
        {
            
    return "Hello !!!!";
        }
    传个字符串是没有问题的!
     AjaxDemo.GetStr(GetStr_callback);
        function GetStr_callback(res)
        {
            alert(res.value);
        }

    但下面这样不行,取不到值!不知道什么原因!
      [AjaxPro.AjaxMethod()]
        
    public ArrayList GetList()
        {
            ArrayList arr 
    = new ArrayList();
            Person P 
    = new Person();
            P.Name 
    = "阿一";
            P.Sex 
    = "";
            arr.Add(
    "猪海");
            arr.Add(P);
            
    return arr;
        }

    ASPX.
     function GetList_callback(response)
        {
            if ( response.error !=null)
            {
                alert("Messagere:"+response.error.Message+"Type:"+response.error.Type);
                return ;
            }
           
           alert(response[0].value + "--"+response[1].Name+"--"+response[2].Sex);
        }
  • 相关阅读:
    VScode 关闭回车后自动格式化代码
    『转载』专利申请
    『转载』 免费公用DNS服务及三大运营商DNS大全 含IPV4和IPV6
    正则表达式和元字符
    随机背景图
    秒表
    数组相关的函数
    对象的结构语法
    数组的结构语法
    展开合并运算符
  • 原文地址:https://www.cnblogs.com/anson/p/347363.html
Copyright © 2011-2022 走看看