ajax_loader

ajax_loader

Prevents caching within the tag

Example

[%ajax_loader%]
    <div>The Content I don’t want to cache</div>
[%/ajax_loader%]

Usage

Prevent any part of your website being cached by the Neto web accelerator by wrapping it in the [%ajax_loader%] function tag.

Pass tags into the body

The content within the ajax_load function tags will load in its own scope with no context of any tags that may be defined outside of the function.

For example, if the following code was run on a product page, the [@sku@] and [@my_custom_tag@] tags would not return anything inside the ajax_loader function:

[%set [@my_custom_tag@]%]custom value[%/set%]

sku: [@sku@]<br>
my_custom_tag: [@my_custom_tag@]<br>
[%ajax_loader%]
    ajax_loaded sku: [@sku@]<br>
    ajax_loaded my_custom_tag: [@my_custom_tag@]
[%/ajax_loader%]

Output:

sku: SMP_1
my_custom_tag: custom value
ajax_loaded sku:
ajax_loaded my_custom_tag:

Tags can be passed into the body of the ajax_loader function by referencing them as function parameters. So if you wanted to expose the [@sku@] tag for use in the ajax_loader function, you could add sku:'1' as a parameter to the function. Similarly, if you wanted to expose the [@my_custom_tag@] tag, you could add my_custom_tag:'1' as a parameter.

For example, if this updated code was run on a product page, the [@sku@] and [@my_custom_tag@] tags would both be available within the ajax_loader function:

[%set [@my_custom_tag@]%]custom value[%/set%]

sku: [@sku@]<br>
my_custom_tag: [@my_custom_tag@]<br>
[%ajax_loader sku:'1' my_custom_tag:'1'%]
    ajax_loaded sku: [@sku@]<br>
    ajax_loaded my_custom_tag: [@my_custom_tag@]
[%/ajax_loader%]

Output:

sku: SMP_1
my_custom_tag: custom value
ajax_loaded sku: SMP_1
ajax_loaded my_custom_tag: custom value

Was this article useful?

Be notified when this page is updated. Optional.