AiArk-21.2.2025/js/post.js
2025-02-21 13:29:52 +01:00

27 lines
590 B
JavaScript

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");
})