I’ve looked for every possible example, but couldn’t find a complete one. I’m new to jQuery and javascript in general – I’m a backend developer. I’m trying to display the html results of an ajax call inside a jstree in a dialog box, and don’t have the first clue what I’m doing. This is what I’ve come up with so far – can someone tell me what I’m doing wrong? (I had to retype this vs copy/paste, so there may be some minor typos).
success: function(data) {
$.getScript("js/jquery/jquery.jstree.js", function() {
var $genericDialog = $("#genericDialog")
$genericDialog.jstree({"html_data":data});
$genericDialog.dialog({
title: "ASDF",
modal: true,
width: 450,
height: 700,
buttons: {
"OK": function() {
$genericDialog.dialog("close");
}
}
});
});
},
From there documentation
So make sure that the object you are passing to “html_data” is in the above format. i.e your ‘data’ should be an object with “data” as its property.
Other than that, I don’t see any problems with your code.
Update
http://jsfiddle.net/STA3c/7/
I have used your code. It seems to be working. Check if all the correct javascript files are loaded properly.