Private
Public Access
1
0
Files
rowsandall/rowers/templates/monitorjobs.html
2019-07-13 18:04:06 +02:00

31 lines
825 B
HTML

<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
</script>
<script>
var previous = null;
var current = null;
var formNotChanged = true;
(function checkJobs() {
console.log('polling');
console.log(formNotChanged)
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/list-jobs/', function(json) {
current = JSON.stringify(json);
$('form').each(function() {
$(this).change(function() {
formNotChanged = false;
console.log("Form Changed");
console.log(formNotChanged)
});
});
if (previous && current && previous !== current && formNotChanged) {
console.log('refresh');
location.reload();
};
previous = current;
});
setTimeout(checkJobs, 5000);
}());
</script>