jsTree ajax 参数甚至不发送请求

时间:2021-04-23 14:31:47

标签: javascript ajax jstree jstree-dnd jstree-search

我正在从 the docs of jsTree 部分复制有关 mySQL 和 php 的所有内容。

我不知道哪里出了问题,我故意没有从给定的例子中改变任何东西,以确保这不是我的错,但仍然没有。 我知道它不应该完全运行,因为链接不是我服务器上的真实路由,但它至少仍然应该尝试联系它们,但是我在浏览器(F12->网络)中没有看到这种通信。

我确实尝试使用服务器上的真实路由修改所有内容,但仍然没有。

我使用的复制的 HTML 和 CDN。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Simple jsTree</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.11/jstree.min.js"></script>

</head>
<body>
    <div id="mmenu" style="height:30px; overflow:auto;">
        <input type="button" id="add_folder" value="add folder" style="display:block; float:left;">
        <input type="button" id="add_default" value="add file" style="display:block; float:left;">
        <input type="button" id="rename" value="rename" style="display:block; float:left;">
        <input type="button" id="remove" value="remove" style="display:block; float:left;">
        <input type="button" id="cut" value="cut" style="display:block; float:left;">
        <input type="button" id="copy" value="copy" style="display:block; float:left;">
        <input type="button" id="paste" value="paste" style="display:block; float:left;">
        <input type="button" id="clear_search" value="clear" style="display:block; float:right;">
        <input type="button" id="search" value="search" style="display:block; float:right;">
        <input type="text" id="text" value="" style="display:block; float:right;">
    </div>
    <div id="demo"></div>
    <div id="alog" style="border: 1px solid gray; padding: 5px; height: 100px; margin-top: 15px; overflow: auto; font-family: monospace; --darkreader-inline-border-top:#4b5457; --darkreader-inline-border-right:#4b5457; --darkreader-inline-border-bottom:#4b5457; --darkreader-inline-border-left:#4b5457;" data-darkreader-inline-border-top="" data-darkreader-inline-border-right="" data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left=""></div>
</body>
</html>
<script type="text/javascript">

$("#demo")
    .bind("before.jstree", function (e, data) {
        $("#alog").append(data.func + "<br />");
    })
    .jstree({ 
        // List of active plugins
        "plugins" : [ 
            "themes","json_data","ui","crrm","cookies","dnd","search","types","hotkeys","contextmenu","ajax" 
        ],
...

脚本的其余部分在 php 和 mySQL 下找到 here

1 个答案:

答案 0 :(得分:0)

这有效

$('#demo').jstree({  
        "core": {  
            "check_callback": true,  
            "data": {
                "url" : "/treeGET",
                "dataType" : "json" 
            } 
         }
    });
相关问题