Wiki source code of Ajax Macro Sample
Last modified by Clemens Robbenhaar on 2022/11/02
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | |||
2 | This sample Ajax Macro class shows some delayed loading on demand or automatically | ||
3 | |||
4 | == On demand loading with custom message == | ||
5 | |||
6 | {{ajax id="1" auto="false" message="click this link to load the content of this div"}} | ||
7 | This content is loaded on demand and can contain **wiki syntax** | ||
8 | {{/ajax}} | ||
9 | |||
10 | {{code}} | ||
11 | {{ajax id="1" auto="false" message="click this link to load the content of this div"}} | ||
12 | This content is loaded on demand and can contain **wiki syntax** | ||
13 | {{/ajax}} | ||
14 | {{/code}} | ||
15 | |||
16 | == Automatic loading == | ||
17 | |||
18 | {{ajax id="2" auto="true"}} | ||
19 | This content is loaded automatically and can contain **wiki syntax** | ||
20 | {{/ajax}} | ||
21 | |||
22 | {{code}} | ||
23 | {{ajax id="2" auto="true"}} | ||
24 | This content is loaded automatically and can contain **wiki syntax** | ||
25 | {{/ajax}} | ||
26 | {{/code}} | ||
27 | |||
28 | == Automatic loading of external page == | ||
29 | |||
30 | {{ajax id="3" page="Macros.AjaxMacroSampleContent" auto="true"/}} | ||
31 | |||
32 | {{code}} | ||
33 | {{ajax id="3" page="Macros.AjaxMacroSampleContent" auto="true" /}} | ||
34 | {{/code}} | ||
35 | |||
36 | == Automatic loading of external URL == | ||
37 | |||
38 | {{ajax id="4" url="http://localhost:8080/xwiki/bin/view/Macros/AjaxMacroSampleContent?xpage=plain" auto="true"/}} | ||
39 | |||
40 | {{code}} | ||
41 | {{ajax id="4" url="http://localhost:8080/xwiki/bin/view/Macros/AjaxMacroSampleContent?xpage=plain" auto="true" /}} | ||
42 | {{/code}} | ||
43 | |||
44 | == Automatic loading with appending == | ||
45 | |||
46 | This sample shows a what's new box loaded in AJAX with a "more" button to load additional data: | ||
47 | |||
48 | {{ajax id="5" page="Macros.AjaxMacroSampleContent2" auto="true" append="true" nb="2" message="More documents" loadingmessage="Loading... please wait" /}} | ||
49 | |||
50 | {{code}} | ||
51 | {{ajax id="5" page="Macros.AjaxMacroSampleContent2" auto="true" append="true" nb="2" message="More documents" loadingmessage="Loading... please wait" /}} | ||
52 | {{/code}} | ||
53 | |||
54 | == Automatic loading with include == | ||
55 | |||
56 | {{include document="Macros.AjaxMacroSampleContent3" /}} |