This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 93a5f6d53fcee9790409e87251c4d49995f6c5e5
tree 343344837122778d36bc679c6e07e33b54bdbf30
parent 6f1c1865f286d42e90ee1260935609b87cbf8d3b
tree 343344837122778d36bc679c6e07e33b54bdbf30
parent 6f1c1865f286d42e90ee1260935609b87cbf8d3b
| name | age | message | |
|---|---|---|---|
| |
README | ||
| |
jquery.periodicalupdater.js |
README
A port of Prototype's Ajax.PeriodicalUpdater function to jQuery.
Basically, this function polls some remote service at fairly regular internvals,
and (optionally) processes the result via a callback. The period of calls will
decay as long as the same response keeps coming back from the server (either in
the form of repeated data or in the form of a 304 Not Modified status), which
reduces the load on the server naturally. The first Ajax call happens as a page
'onReady' handler $(function), so it is safe to put the PeriodicalUpdater call
anywhere on the page.
Usage:
$.PeriodicalUpdater('/path/to/service', {
method: 'get', // method; get or post
data: '', // array of values to be passed to the page - e.g. {name: "John", greeting: "hello"}
minTimeout: 1000, // starting value for the timeout in milliseconds
maxTimeout: 8000, // maximum length of time between requests
multiplier: 2, // if set to 2, timerInterval will double each time the response hasn't changed (up to
maxTimeout)
type: 'text' // response type - text, xml, json, etc. See $.ajax config options
}, function(data) {
// Handle the new data (only called when there was a change)
});
The "data" value can be one of three things:
* A scalar, in which case it will be used constantly.
* A map/object, in which case it will be turned into key/value pairs by jQuery
* An anonymous function, in which case it will be executed before each AJAX call
Any other $.ajax configuration option can be passed to the setting map. The
only exception is the flag that treats modifications as errors. That’s always
going to be 'true'.
More info, including advantages over 360innovate version:
* http://enfranchisedmind.com/blog/posts/jquery-periodicalupdater/
See the source file for license terms.








