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]);


            });
        }

 

posted @ 2017-06-02 21:21  自由无风  阅读(165)  评论(0编辑  收藏  举报