Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 用ajax显示树_Jquery_Html_Ajax - Fatal编程技术网

Jquery 用ajax显示树

Jquery 用ajax显示树,jquery,html,ajax,Jquery,Html,Ajax,我在mysql表中有树数据。我有身份证和父母身份证。我希望用Ajax显示一个树结构。单击节点时,我希望向页面发送一个参数并返回一个数据,然后使用该数据显示子节点 <body> <div id='jstree'> </div> <script> $(function () { // 6 create an instance when the DOM is ready $('#jstree').jstree({ 'cor

我在mysql表中有树数据。我有身份证和父母身份证。我希望用Ajax显示一个树结构。单击节点时,我希望向页面发送一个参数并返回一个数据,然后使用该数据显示子节点

<body>
<div id='jstree'>
</div>
<script>
  $(function () {
    // 6 create an instance when the DOM is ready
    $('#jstree').jstree({
      'core' : {
      'data' : {
       'url' : 'abc.asp?',
      'data' : function (node) {
       return { 'accno' : node.id };
     }
   }
  }
});
    // 7 bind to events triggered on the tree
    $('#jstree').on("changed.jstree", function (e, data) {
      console.log(data.selected);
    });
    // 8 interact with the tree - either way is OK
    $('button').on('click', function () {
      $('#jstree').jstree(true).select_node('child_node_1');
      $('#jstree').jstree('select_node', 'child_node_1');
      $.jstree.reference('#jstree').select_node('child_node_1');
    });
  });
 </script>
</body>

$(函数(){
//6在DOM就绪时创建一个实例
$('#jstree').jstree({
“核心”:{
“数据”:{
“url”:“abc.asp”,
“数据”:函数(节点){
返回{'accno':node.id};
}
}
}
});
//7绑定到树上触发的事件
$('#jstree').on(“changed.jstree”,函数(e,data){
console.log(data.selected);
});
//8与树交互-任何一种方式都可以
$('button')。在('click',函数(){
$(“#jstree”).jstree(true)。选择_节点(“子_节点_1”);
$('jstree').jstree('select_node','child_node_1');
$.jstree.reference(“#jstree”)。选择_节点(“子_节点_1”);
});
});
我真的希望你们能帮我。在我的研究之后,我想要实现的就是所谓的延迟加载。 假设我有一个包含以下数据的sql表

Accno Referral L1A L1B L2A1 L1A L2A2 L1A L2A3 L1A L2B1 L1B L2B2 L1B L2B3 L1B L3A1 L2A1 L3A2 L2A1 L3B1 L2B3 L3B2 L2B2 and so on 阿克诺转介 L1A L1B L2A1 L1A L2A2 L1A L2A3 L1A L2B1 L1B L2B2 L1B L2B3 L1B L3A1 L2A1 L3A2 L2A1 L3B1 L2B3 L3B2 L2B2 等等
  • 最初,我想用+符号加载L1A和L1B,表示它们有子对象
  • 当单击带有子节点的节点时,例如L1A。
    • 如何将参数为accno L1A的url传递到另一个页面进行处理?如何指示node.id为L1A(单击节点时是否会自动检测到?)
  • 将url abc.asp?accno=“L1A”传递到要处理的html/asp页面
  • 在SQL语句中查找accno=“L1A”的子级, 选择。。。。带引用='L1A' 标记有孩子和没有孩子的人的结果
  • 返回结果。
    • 如何在HTML文件中返回结果?我可以将其格式化为任何字符串,但格式是什么
  • 那么,JSTREE如何获取结果并显示呢

  • 请帮忙

    您可以使用
    jstree
    jsTree
    是提供交互式树的
    jquery
    插件。它是完全免费的,开源的,并且在麻省理工学院的许可下发布。jsTree易于扩展、主题化和配置,它支持HTML和JSON数据源以及AJAX加载

    jsTree在任何一种盒子模型(内容盒或边框盒)中都能正常工作,可以作为AMD模块加载,并且具有内置的移动主题,用于响应性设计,可以轻松定制。它使用jQuery的事件系统,因此对树中的各种事件进行绑定回调既熟悉又容易


    您可以使用jqTree或jstree,您可以展示到目前为止您尝试了什么?大家好,谢谢您的回复。我编辑了我的帖子以显示我的进步。请帮助,非常感谢。嗨,我已经编辑了以显示我所做的,请帮助。非常感谢你。