Spaces:
Build error
Build error
Update static/script.js
Browse files39 unmodified lines40414239 unmodified linesalert(`Added to cart: ${foodItem} (x${quantity})`);console.log('Cart:', cart);}39 unmodified lines40414243444546474849505152535455565758596061626339 unmodified linesalert(`Added to cart: ${foodItem} (x${quantity})`);console.log('Cart:', cart);}function addToCart(itemName) {const quantity = document.getElementById(`quantity-${itemName}`).value;fetch("/add_to_cart", {method: "POST",headers: {"Content-Type": "application/json",},body: JSON.stringify({ name: itemName, quantity: quantity }),}).then((response) => response.json()).then((data) => {alert(data.message);// Optionally update cart count in the UI}).catch((error) => {console.error("Error:", error);});}
static/script.js+21