不使用jquery绑定到jstree? [英] Not binding to jstree using jquery?
问题描述
大家好,
我一直在使用我的第一个使用JQuery(jsTree)和Json的应用程序。
我认为一切都很好我能够得到来自SQL Server的数据转换为Json,但现在所有数据都填充了页面,而不是Treeview。
请让我知道为我提供解决方案。
而不是我得到以下错误,
Hi All,
I have been fighting with my first application which uses JQuery (jsTree) and Json.
I thought everything was going great I was able to get the data from SQL server convert to Json but now all the data just fills the page and is not in a Treeview.
please let me know drop a solution for me.
instead of that i got the below error,
JavaScript runtime error: Syntax error, unrecognized expression: [{"caption":"&Master"},{"caption":"&Sales"}] // this is for json data
我的代码是:
My code is :
<script type="text/javascript">
$(function ()
{
$('#jstree2').jstree({'plugins':["defaults","checkbox"], 'core' :
{
"themes":{
"responsive":true
},
"data": {
type: "POST",
url: "Default.aspx",
contentType: "application/json; charset=utf-8",
datatype:"json",
success: function (data) {
data.d;
$(data).each(function () {
return { "id": this.id };
});
}
}
}
}
);
});
</script>
<div id="jstree2" style="margin-top:2em;">
</div>
提前感谢。
我尝试了什么:
使用jquery不绑定到jsTree?
thanks in advance.
What I have tried:
Not binding to jsTree using jquery?
推荐答案
( function ()
{
(' #jstree2').jstree({' plugins':[ 默认为 , 复选框],' < span class =code-string> core':
{
主题:{
响应: true
},
data :{
类型: POST,
url: Default.aspx,
contentType: application / json; charset = utf-8,
数据类型: json,
成功: function (data){
data.d;
('#jstree2').jstree({'plugins':["defaults","checkbox"], 'core' : { "themes":{ "responsive":true }, "data": { type: "POST", url: "Default.aspx", contentType: "application/json; charset=utf-8", datatype:"json", success: function (data) { data.d;
(data).each(< span class =code-keyword> function (){
return { id:此 .id};
});
}
}
}
}
);
});
< / script>
(data).each(function () { return { "id": this.id }; }); } } } } ); }); </script>
<div id="jstree2" style="margin-top:2em;">
</div>
提前感谢。
我的尝试:
使用jquery不绑定到jsTree?
thanks in advance.
What I have tried:
Not binding to jsTree using jquery?
这篇关于不使用jquery绑定到jstree?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!