码迷,mamicode.com
首页 > Web开发 > 详细

string 转 json数据

时间:2016-01-14 17:32:28      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

前台:$(function () {
$.get("index.ashx", { action: "title" }, function (data) {
var result = eval(‘(‘ + data + ‘)‘);

$("h1").html(result.name);
$("h5").html(result.cell);
})
})

 

后台:

string user_id_con = "select use_name,use_cell from dt_User where id=@id";
DataTable dt = DBHelper.GetTable(user_id_con, parameters: new SqlParameter("@id", xx));
return "{\"name\":\"" + dt.Rows[0]["use_name"] + "\",\"cell\":\"" + dt.Rows[0]["use_cell"] + "\"}";

string 转 json数据

标签:

原文地址:http://www.cnblogs.com/zhubenxi/p/5130872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!