<div id="menu">
</div>
JS结构
1 <script type="text/javascript">
2 $.ajax({
3 url:Thinkphp['MODULE'] + '/Index/getTree',
4 type:'post',
5 success:function(data){
6 $.each(data,function(i,n){
7 $('#menu').accordion('add',{
8 title: n.text,
9 selected: false,
10 content:'<div style="padding:0 0 0 10px;"><ul name="'+n.text+'"></ul></div>',
11 });
12 });
13 },
14 });
15 $('#menu').accordion({
16 fit:true,
17 border:false,
18 onSelect:function(title,index){
19 $("ul[name='"+title+"']").tree({
20 lines:true,
21 url: Thinkphp['MODULE'] + '/Index/getTree/Name/'+encodeURI(title),
22 });
23 console.info(title)
24 },
25 });
26 </script>