summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE/client/bower_components/jqTree/_entries/18_data-url.md
blob: 063c151443c3612e275e6edd8a4795b3f2949989 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: dataUrl
name: options-data-url
---

Load the node data from this url.

{% highlight js %}
$('#tree1').tree({
   dataUrl: '/example_data.json'
});
{% endhighlight %}

You can also set the **data-url** attribute on the dom element:

{% highlight html %}
<div id="tree1" data-url="/example_data.json"></div>
<script>
    $('#tree1').tree();
</script>
{% endhighlight %}

You can set additional [jquery ajax options](http://api.jquery.com/jQuery.ajax/) in an object:

{% highlight js %}
$('#tree1').tree({
   dataUrl: {
       url: '/example_data.json',
       headers: {'abc': 'def'}
   }
});
{% endhighlight %}

Or you can use a function:

{% highlight js %}
$('#tree1').tree({
   dataUrl: function(node) {
       return {
           url: '/example_data.json',
           headers: {'abc': 'def'}
       };
   }
});
{% endhighlight %}