客户端有一复杂javascript数组,
function Circle(xPoint, yPoint, radius)
{
    this.x = xPoint;
    this.y = yPoint;
    this.r = radius;
    this.showDetail = CircleDetail;   
    this["description"] = "description for the circle..."; 
}
var PendingOperations=new Array();var op1 = new Object();
op1.Operation = 4;
op1.C = new Circle(50, 50, 100);
op1.Des = "aaa";PendingOperations.push(op1);
var op2 = new Object();
op2.Operation = 2;
op2.C = new Circle(6, 56, 1);
op2.Des = "b";PendingOperations.push(op2);var op3 = new Object();
op3.Operation = 77;
op3.C = new Circle(190, 45, 25);
op3.Des = "c";PendingOperations.push(op3);
document.getElementById("operations").value = PendingOperations;如何传递到服务器端(C#)中在进行处理?我在aspx页面放 <input id="operations" type="hidden" runat="server" /> ,然后C#中:protected void Button1_Click(object sender, EventArgs e)
    {
        string[] opValue = this.operations.Value.Split(',');
                Response.Write("<br>value in hidden:<br>" + this.operations.Value);
    }只能得到[Object],....字符串,如何得到 Circle 对象、Operation属性、Des属性等等???

解决方案 »

  1.   

    用js构建一个post,然后在服务器端用request.form[""].value
    js:
    var oReq = new ActiveXObject("MSXML2.XMLHTTP");
    var str = "xxx=123&yyy=789";
    oReq.open("POST","url",false);
    oReq.setRequestHeader("Content-Length",str.length);  
    oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
    oReq.send(str);
      

  2.   

    序列化成json格式的.
    服务器直接解析就可以了,这个格式还是比较成熟的
      

  3.   

    怎么序列化?比如客户端用js构造的json:
    var myJsonObject ={{"Operation":"2","Des":"aadbb"},{"Operation":"676","Des":"rtrtrtrtrtr"}};1. 通过什么方式传递到服务器端?
    2. 服务器端怎么解析呢?请教akirya.