From 744a54b7074657131ba76a7cee92809410852506 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 22 Aug 2021 12:14:40 +0200 Subject: Correctly append ajax=1 GET parameter to reload URL --- static/js/reload.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/js/reload.js b/static/js/reload.js index 183268d..2a3fbf3 100644 --- a/static/js/reload.js +++ b/static/js/reload.js @@ -7,7 +7,13 @@ document.addEventListener("DOMContentLoaded", function() { }; const fetchDepartures = () => { - fetch(window.location.href + '?ajax=1') + var fetchUrl = window.location.href; + if (fetchUrl.includes("?")) { + fetchUrl += "&ajax=1"; + } else { + fetchUrl += "?ajax=1"; + } + fetch(fetchUrl) .then(response => { if (!response.ok) { throw Error(response.statusText); -- cgit v1.2.3