Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A port of Prototype's PeriodicalUpdater to JQuery
Branch: master

This branch is 103 commits behind RobertFischer:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


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.

$.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)

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:

See the source file for license terms.
Something went wrong with that request. Please try again.