summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-08-22 12:14:40 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-08-22 12:14:40 +0200
commit744a54b7074657131ba76a7cee92809410852506 (patch)
tree4eab990ac2cfd633e700e1e2e4ae9530a7649e07
parent19a6b7679964dfe3927ad6cd2b314ae5a9bb1a8f (diff)
Correctly append ajax=1 GET parameter to reload URL
-rw-r--r--static/js/reload.js8
1 files changed, 7 insertions, 1 deletions
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);