Sometimes you want an AJAX request triggered by time. With [[https://github.com/eldarion/eldarion-ajax|eldarion-ajax]] it is as easy as setting a few attributes in your markup.


There are two forms of timers that eldarion-ajax exposes via a couple of data attributes. The first is Javascript's {{{setTimeout}}} which executes once after a delay. The other is {{{setInterval}}} which repeatedly executes at a prescribed interval of time.

Both are very simple to wire up with [[https://github.com/eldarion/eldarion-ajax|eldarion-ajax]] as of the 0.10.0 release.

Example of using a timeout:

{{{ #!code html

}}}

This will fetch content from {{{/fetch/content/}}} after 2 seconds and load it in the {{{div.alert}}}.

Example of using an interval:

{{{ #!code html

}}}

This will fetch content from {{{/fetch/counter/}}} every 1 second and load it in the {{{div.counter}}}.