From da149682aadbf6da97ed953284fd6cf1814ea8a8 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 31 Oct 2020 16:33:45 +0100 Subject: [PATCH] Improve load behavior of ajaxpending.js --- .../presale/templates/pretixpresale/waiting.html | 2 +- src/pretix/static/pretixbase/js/ajaxpending.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pretix/presale/templates/pretixpresale/waiting.html b/src/pretix/presale/templates/pretixpresale/waiting.html index bfe0c758ca..af64e9f9de 100644 --- a/src/pretix/presale/templates/pretixpresale/waiting.html +++ b/src/pretix/presale/templates/pretixpresale/waiting.html @@ -13,7 +13,7 @@ {% endcompress %} - +
diff --git a/src/pretix/static/pretixbase/js/ajaxpending.js b/src/pretix/static/pretixbase/js/ajaxpending.js index 788f24a361..b2024c3e96 100644 --- a/src/pretix/static/pretixbase/js/ajaxpending.js +++ b/src/pretix/static/pretixbase/js/ajaxpending.js @@ -1,7 +1,10 @@ -window.setInterval(function () { - $.get(location.href + '?ajax=1', function (data, status) { - if (data === "1") { - location.reload(); +var check = function () { + $.getJSON(location.href + '&ajax=1', function (data, status) { + if (data.redirect) { + location.href = data.redirect; + } else { + window.setTimeout(check, 500); } }); -}, 500); +} +window.setTimeout(check, 500);