BiryaniHub / templates /menu.html
DSatishchandra's picture
Create menu.html
cfd7e45 verified
raw
history blame
1.05 kB
<!DOCTYPE html>
<html>
<head>
<title>Menu</title>
</head>
<body>
<h1>Biryani Hub - Menu</h1>
<a href="/cart">View Cart</a>
<div>
{% for item in menu_items %}
<div>
<img src="{{ item.Image1__c }}" alt="Food Image" style="width: 100px; height: 100px;">
<h3>{{ item.Name }}</h3>
<p>{{ item.Description__c }}</p>
<p>${{ item.Price__c }}</p>
<button onclick="addToCart('{{ item.Name }}', {{ item.Price__c }})">Add</button>
</div>
{% endfor %}
</div>
<script>
function addToCart(name, price) {
fetch("/add_to_cart", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: name, price: price })
})
.then(response => response.json())
.then(data => alert(data.message))
.catch(error => console.error("Error:", error));
}
</script>
</body>
</html>