About this Plugin

A jQuery plugin to update element contents or attributes in a specific interval using ajax.

Feedback

Send me a email to feedback@sebastian-joseph.de.

Documentation

First you have to load the script after the jQuery main library. Then you can call the autoUpdate method at each element you want to update automatically.

Name Default Value Type Description
source undefined string This parameter will be passed to the jquery.get() as is and the response data will be passed to the converter as first parameter.
type 'text' string This parameter will be passed to the jquery.get() as is.
data {} object This parameter will be passed to the jquery.get() as is.
converter undefined function The return value of this function will replace the elements content or an elements attribute content.
changeAttr undefined string If set, change the attribute with this name.
changeHtml false boolean When set to true, and changeAttr is false then it will replace the content as html, else as plain text.
interval 60 integer The interval of fetching the url and calling the converter in seconds.

Example: $("h1").autoUpdate({"source":"http://same-domain.tld/data/source", "converter":function(data) { return data." - append something"; }, "data": {"foo":"bar"}, "interval": 360});

Download

Latest version