var processData = {
"total": 2,
"list": [
{ "id": "1", "flow_id": "4",},
{ "id": "3", "flow_id": "4", }
]
}
上面这是我前台需要用到的,
$.get("../Public/handler/Test_show.ashx", function (data) {
????
},'json')
这里要怎么写呢,这个data我想变成数组格式直接使用,开始把‘json’写成text类型,但是传不出我需要的样式,到这里卡住了。
后台返回如下
Dictionary list = new Dictionary();
ArrayList al = new ArrayList();
foreach ( DataRow dr in dt.Rows )
{
Dictionary dic = new Dictionary();
foreach (DataColumn dc in dt.Columns)
{
dic.Add(dc.ColumnName, dr[dc.ColumnName].ToString());
}
al.Add(dic);
}
Dictionary all = new Dictionary();
all.Add("total",2);
all.Add("list", al);
// list.Add("msg", "OK");
// list.Add("processdata",all);
context.Response.Write(jss.Serialize(all));