document.addEventListener('DOMContentLoaded', function () { const submit = document.getElementById('submitbtn'); submit.addEventListener('click', async () => { submit.disabled = true; const action = submit.parentElement.action; try { const resp = await fetch(action, { method: 'POST', body: JSON.stringify({ os: document.getElementById('os-select').value, form: document.getElementById('form-select').value }), headers: { "Content-Type": "application/json", } }); if (!resp.ok) { throw new Error(`Response status: ${resp.status}`); } location.reload(); return false; } catch (error) { console.error(error.message); alert(error.message); } }); });