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);
        }
  • 相关阅读:
    ScrollView 实现循环轮播
    UINavigationController和UITabBarController合用
    iOS开发网络篇—网络编程基础
    iOS开发网络篇—搭建本地服务器
    iOS开发网络篇—HTTP协议
    iOS开发网络篇—GET请求和POST请求
    UIView
    iOS准备程序
    iOS小程序-混合计算器
    IOS入门-计算机小程序
  • 原文地址:https://www.cnblogs.com/anson/p/347363.html
Copyright © 2011-2022 走看看