window.onload = function () { document.getElementById('diceForm').addEventListener('submit', function (event) { event.preventDefault(); // Prevent the form from submitting via the default form action const quantity = parseInt(document.getElementById('quantity').value, 10); const geometry = parseInt(document.getElementById('geometry').value, 10); const discard = document.getElementById('discard').checked; const queryParams = new URLSearchParams({ quantity: quantity, geometry: geometry, discard_lowest: discard }); const urlToFetch = `${window.BASE_URL}/dice?${queryParams}`; console.log(`URL to fetch: ${urlToFetch}`); fetch(urlToFetch) .then(response => response.json()) .then(data => { const resultsDiv = document.getElementById('results'); let html = ''; if (data['dice-set']) { let diceSet = data['dice-set']; html += '