40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
setInterval(function() {
|
|
$.getJSON('/list', function (data) {
|
|
$( "#konfis" ).html('');
|
|
$.each( data, function( i, item ) {
|
|
if (item.gemeinde != undefined) {
|
|
$( "#konfis" ).append('<tr> ' +
|
|
'<td>' + item.name + '</td> ' +
|
|
'<td>' + item.gemeinde + '</td> ' +
|
|
'<td>' + item.kcoins + '</td>' +
|
|
'</tr>');
|
|
} else {
|
|
$( "#konfis" ).append('<tr> ' +
|
|
'<td>' + item.name + '</td> ' +
|
|
'<td>' + item.kcoins + '</td>' +
|
|
'<td>' + (item.coins_quota).toFixed(2) + '</td> ' +
|
|
'</tr>');
|
|
}
|
|
});
|
|
});
|
|
}, 1000);
|
|
/*
|
|
var loc = window.location;
|
|
var uri = 'ws:';
|
|
|
|
if (loc.protocol === 'https:') {
|
|
uri = 'wss:';
|
|
}
|
|
uri += '//' + loc.host;
|
|
uri += loc.pathname + 'ws';
|
|
|
|
ws = new WebSocket(uri)
|
|
|
|
ws.onopen = function() {
|
|
console.log('Connected');
|
|
ws.send('get');
|
|
};
|
|
|
|
ws.onmessage = function(evt) {
|
|
console.log(evt.data);
|
|
};*/ |