Added some AJAX to dynamically update the server's run status

This commit is contained in:
2022-09-24 21:29:12 -04:00
parent 5699c9cf6a
commit efde09025c
3 changed files with 35 additions and 10 deletions

View File

@ -1,3 +1,12 @@
$(document).ready(function () {
// this will be used later.
$('.serverItem').each(function() {
setInterval(updateServer, 5000, $(this));
});
});
function updateServer(elem) {
var serverName = elem.data('server-name');
$.get('/server/' + serverName + '/status', function(data, state) {
elem.children('.serverState').eq(0).text(data.state);
});
}