Jquery解析JSON数据(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-18 03:25 点击:次
}
}
}
②前台解析JSON数据
<head runat="server">
<title></title>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.getJSON(
"JsonHandler.ashx",
function(data) {
$.each(data, function(i) {
$("#cat-list").append("<li>name:" + data[i].name + " Age:" + data
[i].age+ "</li>")
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ul id="cat-list"></ul>
</div>
</form>
</body>
例子二:
①建立页面处理后台,.aspx
public partial class AutoDB2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder str = new StringBuilder();
string strCon = @"Data Source=.\SQLEXPRESS;Initial
Catalog=TeacherFiles;User ID=sa;pwd=as";
SqlConnection con = new SqlConnection(strCon);
string sql = string.Format("select TeacherNum,TeacherName from
TeacherBasicInformation");
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>