# Example: Lazy loading

Using `initAjax` option to initialize the tree using Ajax.
The folders have the `isLazy` option set, so that they are also loaded 'on demand', when expanded.
Using `persist: true` and `initAjax: { addExpandedKeyList: true }` we also support 'lazy persistence' (which has to be supported by the web service, of course).
Note:
This sample assumes that a Dynatree Web Service is running at http://127.0.0.1:8001.
See dynatree_server.py for a sample server implementation.
Note also:
We have to enable JSONP using the option `initAjax: { dataType: 'jsonp' }`, because Ajax calls will fail, if the originating HTML page and the web service do not reside on the same host.
In our case may have this sample page on the local file system and the web service runs on 127.0.0.1.

Loading...
Active node: -

jquery.dynatree.js project home Link to this page Example Browser View source code