27 lines
590 B
JavaScript
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");
|
||
|
|
||
|
})
|