I am attempting to use json data to build a jstree as below:
$(document).ready(function () {
$(function () {
$("#left").jstree({
"json_data" : {
"ajax" : {
"url": "http://192.168.101.2/img/jstree.json",
"data" : function (n) {
return { id : n.attr ? n.attr("id") : 0 };
}
}
},
"plugins" : [ "themes", "json_data" ]
});
});
});
my tree is not building, any ideas what I am doing wrong?
Here is the solution
You have to use one of these
$().ready(function() {})or$(function() {}). These both have same meaning.