问题描述
我正在从 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"
],...
解决方法
这有效
$('#demo').jstree({
"core": {
"check_callback": true,"data": {
"url" : "/treeGET","dataType" : "json"
}
}
});