level 3
xyzwawa
楼主
后台返回的数据:
"[
{
\"id\": \"1\",
\"pId\": \"0\",
\"name\": \"类别\",
\"open\": \"true\"
},
{
\"id\": \"A38C6434-A9F2-4C86-A4CC-F9C259C0E030\",
\"pId\": \"1\",
\"name\": \"青菜\"
},
{
\"id\": \"B0A6BF68-08CF-4AC9-BD09-F18B0CD9C3DF\",
\"pId\": \"1\",
\"name\": \"萝卜\"
},
{
\"id\": \"CB438203-BF32-4606-9AF6-621C553C5594\",
\"pId\": \"1\",
\"name\": \"黄瓜\"
},
{
\"id\": \"D45F148F-E077-4E88-8352-361E1B5028E6\",
\"pId\": \"1\",
\"name\": \"西红柿\"
}
]"
用Response.Write(str) 返回数据
前台:接受数据
$(document).ready(function () {
$.ajax({
type: "POST",
url: "Handle.aspx",
data: "ac=get&type=class",
success: function (msg) {
treeData = jQuery.parseJSON(msg);
var json = eval('(' + treeData + ')');
zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, json);
},
error: function (xhr, msg, e) { alert(msg); }
}); });
2012年05月11日 06点05分
1
"[
{
\"id\": \"1\",
\"pId\": \"0\",
\"name\": \"类别\",
\"open\": \"true\"
},
{
\"id\": \"A38C6434-A9F2-4C86-A4CC-F9C259C0E030\",
\"pId\": \"1\",
\"name\": \"青菜\"
},
{
\"id\": \"B0A6BF68-08CF-4AC9-BD09-F18B0CD9C3DF\",
\"pId\": \"1\",
\"name\": \"萝卜\"
},
{
\"id\": \"CB438203-BF32-4606-9AF6-621C553C5594\",
\"pId\": \"1\",
\"name\": \"黄瓜\"
},
{
\"id\": \"D45F148F-E077-4E88-8352-361E1B5028E6\",
\"pId\": \"1\",
\"name\": \"西红柿\"
}
]"
用Response.Write(str) 返回数据
前台:接受数据
$(document).ready(function () {
$.ajax({
type: "POST",
url: "Handle.aspx",
data: "ac=get&type=class",
success: function (msg) {
treeData = jQuery.parseJSON(msg);
var json = eval('(' + treeData + ')');
zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, json);
},
error: function (xhr, msg, e) { alert(msg); }
}); });
