document.addEventListener('DOMContentLoaded', function() { const form = document.getElementById('ip-form'); const qrCodeContainer = document.getElementById('qr-code-container'); const submissionsTable = document.getElementById('submissions-table'); form.addEventListener('submit', function(e) { e.preventDefault(); const formData = new FormData(form); const selectedIp = formData.get('ip'); fetch('/private/generate_qr', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ ip: selectedIp }), }) .then(response => response.json()) .then(data => { qrCodeContainer.innerHTML = `
Error generating QR code. Please try again.
'; }); }); function updateSubmissions() { fetch('/private/get_last_submissions') .then(response => response.json()) .then(data => { let tableHtml = `