document.getElementById('orderForm').addEventListener('submit', async (event) => { event.preventDefault(); const form = document.getElementById('orderForm'); const formData = new FormData(form); const data = {}; formData.forEach((value, key) => { data[key] = value; }); console.log ("ok"); const response = await fetch('./php/post.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); console.log("ok"); })