Private
Public Access
1
0

with jquery to refresh when tasks are complete

jquery lives in basebase.html. Perhaps should live in individual pages
This commit is contained in:
Sander Roosendaal
2017-10-30 22:32:34 +01:00
parent 21be4d278b
commit 98abc68289
5 changed files with 41 additions and 9 deletions

View File

@@ -9,6 +9,31 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
var previous = null;
var current = null;
$(document).ready(function() {
$.getJSON('http://localhost:8000/rowers/list-jobs/', function(json) {
current = JSON.stringify(json);
previous = current;
});
console.log('initial poll');
});
setInterval(function() {
$.getJSON('http://localhost:8000/rowers/list-jobs/', function(json) {
current = JSON.stringify(json);
if (previous && current && previous !== current) {
console.log('refresh');
location.reload();
};
previous = current;
});
console.log('polling');
}, 15000)
</script>
<script src="/static/cookielaw/js/cookielaw.js"></script>
{% analytical_head_top %}
{% if GOOGLE_ANALYTICS_PROPERTY_ID %}