There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

load-as-ajax

Syntax

load-as-ajax: (selector) [every (time)] [after (time)][, (class)...];

selector = A valid CSS selector referencing a single element containing HTML that you want to "fetch".

This command simulates an ajax call, but instead of fetching a file from the server, it takes the inner HTML contents from an element.

The event "afterLoadAsAjax" runs directly afterwards. Contents are available in the {$STRING} variable, or the {$HTML}, {$HTML_NOVARS} and {$HTML_ESCAPED} variables. See the Special variables section in the variables section of the docs for more information on those variables.

One particular use for this command is that it makes it easier to convert an ajax-based SPA into a standalone offline website running on file:// where ajax calls are disallowed. Inner page content can be placed into template tags and this command can be used as a direct replacement for the ajax command. See the offline interactive website page for more information on that.