Example 5 - Load nodes on demand from the server

In this example, the data is loaded on demand from the server.
To use load on demand, you must do the following:

first level of data


[
  {
    label: 'Saurischia',
    id: 1,
    load_on_demand: true
  },
  {
    label: 'Ornithischians',
    id: 23,
    load_on_demand: true
  }
]

html


<div id="tree1" data-url="/nodes/"></div>

javascript


$('#tree1').tree({
    dragAndDrop: true
});