Private
Public Access
1
0

reload only on selected pages

Doesn't refresh page when a form has been edited
This commit is contained in:
Sander Roosendaal
2017-11-03 12:37:26 +01:00
parent 89fb917707
commit c07c6311ca
10 changed files with 69 additions and 28 deletions

View File

@@ -9,32 +9,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
</script>
<script type="text/javascript">
window.jQuery || document.write('<script src="/static/js/jquery-3.1.0.js"><' + '/script>');
</script>
<script>
var previous = null;
var current = null;
(function checkJobs() {
console.log('polling');
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/list-jobs/', function(json) {
current = JSON.stringify(json);
if (previous && current && previous !== current) {
console.log('refresh');
location.reload();
};
previous = current;
});
setTimeout(checkJobs, 15000);
}());
</script>
{% block scripts %} {% endblock %}
<script src="/static/cookielaw/js/cookielaw.js"></script>
{% analytical_head_top %}