data-cache, data-cache-name

Prevents browsers from getting cached response instead of calling your endpoint.

If data-cache is set to true, endpoint defined in data-endpoint will be appended with a query string containing a unique string (a timestamp and a random number). With that unique URL, a browser will not consider the endpoint as already-downloaded and will not use cached contents.
The data-cache-name option let you change the name of the variable used to store that unique string. If you set it to bob, then the query string will look like ?bob=121351987234132. Note that this name should be composed of alphabetic characters and underscore.

By default, data-cache is set to false, and data-cache-name is set to ajax.

Usage


  • data-cache="(true or false)"
  • data-cache-name="(a name composed of a-zA-Z_)"

Example


  • data-cache="true"
  • data-cache-name="ajax"

Live examples

This form looks like this:


<input
        type="button"
        value="data-cache=&quot;true&quot;"
        class="btn domajax click"
        data-endpoint="cache-basic-handler.php"
        data-cache="true"
        data-output="#output"
        />

<br/><br/>

<input
        type="button"
        value="data-cache=&quot;false&quot;"
        class="btn domajax click"
        data-endpoint="cache-basic-handler.php"
        data-cache="false"
        data-output="#output"
        />

<div id="output"></div>


Table of contents

All the documentation at a glance

Domajax options

And more with domajax