aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/data/updater.js
blob: 20201f84864ec85ea10c10a9ff4ec535ef4cb849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var updater = Class.create({
	initialize: function(divToUpdate, interval, file) {
		this.divToUpdate = divToUpdate;
		this.interval = interval;
		this.file = file;
		new PeriodicalExecuter(this.getUpdate.bind(this), this.interval);
	},
	
	getUpdate: function() {
		var oOptions = {
			method: "POST",
			parameters: "intervalPeriod="+this.interval,
			asynchronous: true,
			onComplete: function (oXHR, Json) {
				$(this.divToUpdate).innerHTML = oXHR.responseText;
			}
		};
		var oRequest = new Ajax.Updater(this.divToUpdate, this.file, oOptions);
	}
});