Konfi-Castle-Kasino/assets/js/load.js

41 lines
1.1 KiB
JavaScript

setInterval(function() {
$.getJSON('/list', function (data) {
//console.log(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.CoinsQuota).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);
};*/