Okay, I've kind of painted myself into a corner, with respect to my jQuery (I'm learning).
In the HTML I have:
<div class="folders-hierarchy">
<ul id="folders-hierarchy"></ul>
</div>
And the jQuery is:
$(document).ready(function(){
function get_folders_hierarchy () {
var folder_id = ($(this).attr("data-folder") == false) ? 0 : $(this).attr("data-folder");
$.ajax({
url: base_url + "folders/jq_get_folders_hierarchy/" + 0,
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false,
success: function (element) {
for (var i=0;i<element.length;i++) {
$("#folders-hierarchy").append('<li data-folder="' + element[i].folder_id + '">' + element[i].name + '</li>');
}
}
});
}
get_folders_hierarchy();
});
While this all works for the first run, I need to add a click event to the unnumbered list item in the .append() function. Sadly, I don't know how.
Just so you know, I'm attempting to create a folder selector, which the unnumbered list is designed to render.