首页 > 代码库 > js处理C#的json

js处理C#的json

 List<string> listss = new List<string>();
        StringBuilder sb = new StringBuilder();
        foreach (Model.books book in lists)
        {
            sb.Append("<div>" + book.Id + "---" + book.Title + "---" + book.Bcon + "--" + book.Btime+"</div>");

        }
        listss.Add(sb.ToString());
        listss.Add(Common.pageper.GetpageBar2(PageIndex, PageCount));
        System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
        context.Response.Write(js.Serialize(listss));

 

        function pagei(pageindex, pagecount)
        {
            $.post("/com/page.ashx", { "pageindex": pageindex, "pagecount": pagecount }, function (data) {
                var cc = $.parseJSON(data);
                $("#page1").html(cc[0]);
                $("#page2").html(cc[1]);


            });
        }

 

js处理C#的json