Features
Actions:- stop updating.
- restart updating after stop.
- dynamically reprogram current timeout
- remotely set timeout ( server controls polling period )
- state attribute shows current state ( ON | OFF | undefined )
- timeout attribute shows current timeout
- smart updateing - updates only if new data is different from the old one (text or json only.)
- multiplies polling interval - multiplies polling interval each time data is not changed (text or json only.)
- handle ajax failures - stop to request data after "maxFailedRequests".
List of available functions
smartupdaterStop()- to stop pollingsmartupdaterRestart()to run polling againsmartupdaterSetTimeout()- to set a new polling interval
List of available attributes
smartupdaterStatus.statecurrent state ( ON | OFF | undefined )smartupdaterStatus.timeoutcurrent timeout
List of available options
url- URL for the ajax request. (Required!)type- Can be either GET or POST (see jQuery.ajax for details)data- Array of values to be passed to the page (see jQuery.ajax for details)dataType- Response type – can be text, xml, json etc. (see jQuery.ajax for details)minTimeout- Starting value for the timeout in milliseconds.maxTimeout- Maximum length of time between requests.multiplier- Sets the amount of decay between ajax requests. If this is set to 2, the length of time between each request will double while the response doesn’t change.maxFailedRequests- smartupdater stops after this number of consecutive ajax failures;
See demo at
get source of smartupdater2 from:
Any questions, comments or suggestions are welcome :)