Shopping Cart

Item A

$10

Item B

$20

Your Cart

Total: $0

document.getElementById('checkout-form').addEventListener('submit', function(e) { e.preventDefault(); const formData = new FormData(this); const cartData = JSON.stringify(cart); // assuming cart is your array fetch('/checkout', { method: 'POST', body: JSON.stringify({ buyer: Object.fromEntries(formData), cart: cartData }), headers: { 'Content-Type': 'application/json' } }).then(response => response.json()) .then(data => alert('Order placed successfully!')); });