nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jqTree / _entries / 18_data-url.md
1 ---
2 title: dataUrl
3 name: options-data-url
4 ---
5
6 Load the node data from this url.
7
8 {% highlight js %}
9 $('#tree1').tree({
10    dataUrl: '/example_data.json'
11 });
12 {% endhighlight %}
13
14 You can also set the **data-url** attribute on the dom element:
15
16 {% highlight html %}
17 <div id="tree1" data-url="/example_data.json"></div>
18 <script>
19     $('#tree1').tree();
20 </script>
21 {% endhighlight %}
22
23 You can set additional [jquery ajax options](http://api.jquery.com/jQuery.ajax/) in an object:
24
25 {% highlight js %}
26 $('#tree1').tree({
27    dataUrl: {
28        url: '/example_data.json',
29        headers: {'abc': 'def'}
30    }
31 });
32 {% endhighlight %}
33
34 Or you can use a function:
35
36 {% highlight js %}
37 $('#tree1').tree({
38    dataUrl: function(node) {
39        return {
40            url: '/example_data.json',
41            headers: {'abc': 'def'}
42        };
43    }
44 });
45 {% endhighlight %}