.Net Json


    JSON.NET 主页下载 和  帮助文档

将下载的DLL,XML和***放入bin中,然后在解决方案中添加.NET以用。就可以使用了。

服务器端:
List<TechnologyObject> list = new List<TechnologyObject>();
                 for ( int i = 1; i <= 6; i++)
                {
                        TechnologyObject technologyObject = new TechnologyObject();
                        technologyObject.m_carTimes = i.ToString();
                  
                        list.Add(technologyObject);
                }
                 string json = JsonConvert.SerializeObject(list, Formatting.Indented);
                Response.ContentType = "application/json";
                 string backjson = "{'root': " + json + "}";
                Response.Write(backjson);


JS端:
// 发送数据请求
        $.post("Ajax.aspx", { Action: "post", Table: "TechnologyCheck" },
        function (data, status) {
            //alert(data.root.length);
            $.each(data.root, function (idx, item) {
                var str = "<td>" + item.m_carTimes; +"</td>";
          
                $("#mytable tr:last").after("<tr>" + str + "</tr>");
                //$('#displayTable tr:last').after('<tr><td class="name">xiaoqinag</td><td class="dob">xiaoqiang</td></tr>');
                styleFunc();

            });
        }, "json");

你可能感兴趣的:(jquery,json,职场,休闲)