--- title: Load nodes on demand from the server in javascript tree layout: page js: examples/load_on_demand.js css: example.css ---

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

{% highlight js %} [ { "label": "Saurischia", "id": 1, "load_on_demand": true }, { "label": "Ornithischians", "id": 23, "load_on_demand": true } ] {% endhighlight %}

html

{% highlight html %}
{% endhighlight %}

javascript

{% highlight js %} $('#tree1').tree({ dragAndDrop: true }); {% endhighlight %}