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