jquery 求解
function getData() {
alert("11"); //会弹窗
$.getJSON("jsonData.ashx", //产生JSON数据的服务端页面
function (json) {
$.each(json, function (i) {
$("#cat-list").append("<li>name:" + json[i].name + " Age:" + json[i].age + "</li>")
})
});
}
<div id="categories">
<h3 title="选择一个分区">
<span>选择</span></h3>
<input id="Button1" type="button" value="获取数据" onclick="getData()" />
<ul id="cat-list">
</ul>
</div>
context.Response.ContentType = "text/plain";
string data = "[{"name":"fan","age":"26"},{"name":"wang","age":"25"}]";//构建的json数据
//下面两句是用来测试前台向此页面发出的查询字符
context.Response.Write(data);
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string data = "[{"name":"fan","age":26},{"name":"wang","age":25}]";//构建的json数据
//下面两句是用来测试前台向此页面发出的查询字符
context.Response.Write(data); ;
}