aboutsummaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-05-20 22:12:24 +0200
committeruser <user@node5.net>2024-05-20 22:12:24 +0200
commit4d3d4f92044cbab22fc27de67de9ce9e6c2c86f7 (patch)
tree9c0419393ce257bf18c780ec55faba8133a9da42 /src/static
parent981e288dcf4f7f944fc32dacac0a611fa4c48423 (diff)
optimization - don't reload page for query
Diffstat (limited to 'src/static')
-rw-r--r--src/static/main.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/static/main.js b/src/static/main.js
index 58052b7..9bdaa11 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -13,6 +13,12 @@ var heatmap = L.featureGroup().addTo(map);
const CategoryField = document.getElementById('Category');
const LoadingIndicator = document.getElementById('LoadingIndicator');
+const form = document.getElementById('QueryForm');
+
+form.addEventListener('submit', (event) => {
+ event.preventDefault(); // Prevents the default form submission
+ runQueryAfterLoad()
+});
const DefaultSearchValue = "supermarket";
var Categories = []
@@ -27,6 +33,8 @@ var layerControl = L.control.layers({},overlayMaps).addTo(map);
function runQueryAfterLoad() {
LoadingIndicator.hidden = false;
+ markers.clearLayers();
+ polygons.clearLayers();
fetchAll(CategoryField.value);
}