阿里云折扣码

轻云博客 > Jquery+Ajax学习 > JQuery异步反序列化DataTable返回Json数据,并生成HTML

JQuery异步反序列化DataTable返回Json数据,并生成HTML

作者:Aisencici / 日期:2014-4-28 0:33:00 / 分类:Jquery+Ajax学习 / 浏览:6520

JQuery:

               




Ajax:

  try

            {

                DataTable dt = Abos.BGetTb();

                JsonSerializerSettings Setting = new JsonSerializerSettings();

                Setting.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

                string result = JsonConvert.SerializeObject(new { ArticleTitles = dt }, Formatting.Indented, Setting);

                context.Response.Write(result);

            }

            catch (Exception ex) { throw ex; }

        }


这里最主要的是:

引用:using Newtonsoft.Json;

获取DataTable数据以后的三段序列化DataTable为JSON的代码。

如果没有 Newtonsoft.Json引用可以去网上下载。


本文标签:JQuery、异步反序列化、Json
From:http://blog.sina.com.cn/s/blog_ab6b84200101a4x3.html
分享到: