Loading...
 
Skip to main content

History: PluginAJAXLoad

Preview of version: 12

Plugin AJAX Load

This wiki plugin, introduced in Tiki14.1, can be used to load HTML into a wiki page, from another page on the same site or an external site (when used in combination with the access_control_allow_origin pref on Control Panels -> General -> Settings). If JavaScript is disabled on the client browser the data will be rendered in an IFRAME.

Parameters

Load data into an HTML div using Ajax or in an iframe.
Introduced in Tiki 14.1. Required parameters are in bold.
Go to the source code
Preferences required: wikiplugin_ajaxload

Parameters Accepted Values Description Default Since
(body of plugin) JavaScript to run when the data is loaded, the incoming HTML is in a variable called data. You can modify that variable's contents to customise the HTML.
url url Address of the data to load, for example, tiki-index_raw.php?page=Page+Name 14.1
height In pixels or percentage. Default value is auto. auto 14.1
width In pixels or percentage. Default value is 100No value assigned 14.1
class text Class for the div or iframe. 14.1
id text HTML id for the div or iframe. 14.1
selector none jQuery selector to retrieve part of the page when using Ajax, for example, #page-data 14.1
target none Where to load the Ajax data into (will create own DIV if not supplied. When using iframe if JavaScript is disabled it will appear where the plugin is in the page. 14.1
mode (blank)
div
iframe
Choose whether to load data into an HTML div using Ajax or in an iframe. div 26.1
responsive (blank)
16by9
4by3
no
Make the display responsive so that browsers determine dimensions based on the width of their containing block by creating an intrinsic ratio that will properly scale on any device. 16by9 26.1
scrolling (blank)
yes
no
auto
Choose whether to add a scroll bar 26.1
absolutelinks (blank)
src
href
none
Convert relative links in the incoming data to be absolute. Default value is "All". 14.1

Examples

Basic Example

Copy to clipboard
{AJAXLOAD(url="http://example.com/tiki-index.php" selector="#page-data")}alert(data.length + " bytes of data received"); {AJAXLOAD}

Superfish menu from a structure

In order to make page loading faster you can use AJAXLOAD to load a menu from a structure asynchronously. Put the menu in a module in a page (here called "structure menu test") and add this to a wiki enabled custom module (here called "test_structure_menu") and assign it to the topbar module zone ( warning: if you leave out the {literal} tags you will probably make your tiki unusable and will need to edit the database to get it back!).

Copy to clipboard
{literal}{AJAXLOAD(url="tiki-index_raw.php?page=structure+menu+test" selector="#structure_menu")} setTimeout(function () {$("#mod-test_structure_menutopbar1").superfish();}, 500); {AJAXLOAD}{/literal}


Related Plugins: PluginIframe, Pluginincludeurl

History

Advanced
Information Version
Rodriguez Nyiringabo Improve the doc 15
Rodriguez Nyiringabo Remove the doc related to the javascript pref as no modern site runs without javascript. 14
Josue Zirimwabagabo 13
Benoit Grégoire 12
Jonny Bradley 11
Jonny Bradley 10
Jonny Bradley 9
Jonny Bradley added menu example 8
lindon 7
lindon 6
lindon 5
lindon 4
lindon 3
Jonny Bradley 2
Jonny Bradley 1