with jquery to refresh when tasks are complete
jquery lives in basebase.html. Perhaps should live in individual pages
This commit is contained in:
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user