I am using jsTree jQuery plugin in a project, I am getting the data correctly from the database, but clicking to the nodes that have children doesn’t do anything.
The data is displaying as it should in HTML format.
You are now producing the html below. See my comments below. Your php logic is still off. Right out your algorithm on paper without code first. Once you figure out the pseudo-code version, then try to write it in php.
<ul>
<li>Business
<ul>
<li>Leo Rodriguez</li>
</ul>
</li>
<li>Computer Science
<ul>
<li>Harry Jones</li>
</ul> // should not be closing this off yet, because Sabi needs to have an li element
</li> // should not be closing this off yet, because there are more in the same department
<ul> // should only be starting a new ul element when the department changes
<li>Sabi</li> // this line needs to below the Harry Jones li element.
</ul>
</li>
<li>IT
<ul>
<li>Tim Ben</li>
</ul>
</li>
<li>Marketing
<ul>
<li>John Doe</li>
</ul>
</li>
</ul>