Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, in the end, it was an issue with the parent-child id attributes:</p> <pre><code>$(document).ready(function() { var objCategories = new Object ({ id: 0 }); $('#load-structures').click(function(event) { event.preventDefault(); objCategories.id = $(this).attr("data-category"); categories(); }); function categories() { $(".flash").show(); $(".flash").fadeIn(400).html("Loading..."); $.ajax({ url: base_url + "notes/jq_get_structures/" + objCategories.id, contentType: "application/json; charset=utf-8", dataType: "json", cache: false, success: function (element) { $(".flash").hide(); $(".load-link").addClass("link-none"); for (var i=0;i&lt;element.length;i++) { if (element[i].parent == 0) { $("#links-structures-parents").append('&lt;li id="structure-parent-' + element[i].structure_id + '"&gt;&lt;a href="#structures" title="View ' + element[i].name + '" class="structures"&gt;&amp;lsquo;' + element[i].name + '&amp;rsquo;&lt;/a&gt;'); } else if (element[i].parent &gt; 0) { var htmlElementParent = $("#structure-parent-" + element[i].parent); var htmlElementChild = $("#structure-children-" + element[i].parent); var htmlElementChildren = $("ul#structure-children-" + element[i].parent + " li"); if (htmlElementChildren.length == 0) { htmlElementParent.append( '&lt;ul id="structure-children-' + element[i].parent + '"&gt;' + '&lt;li id="structure-child-' + element[i].structure_id + '"&gt;' + '&lt;a href="#structures" title="View ' + element[i].name + '" class="structures"&gt;&amp;lsquo;' + element[i].name + '&amp;rsquo;&lt;/a&gt;' + '&lt;/li&gt;&lt;/ul&gt;' ); } else if (htmlElementChildren.length &gt; 0) { htmlElementChild.append( '&lt;li id="structure-child-' + element[i].structure_id + '"&gt;' + '&lt;a href="#structures" title="View ' + element[i].name + '" class="structures"&gt;&amp;lsquo;' + element[i].name + '&amp;rsquo;&lt;/a&gt;' + '&lt;/li&gt;' ); } } } $("#load-structures").hide(); }, error: function () { $("#links-structures-parents").empty(); $("#links-structures-parents").append('&lt;li&gt;There are no Structures.&lt;/li&gt;'); } } ); } }); </code></pre> <p>Here, you'll see that I'm appending to unnumbered lists whose id attributes contain the parent values, which then feeds the list items into their respective and proper unnumbered lists.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload