19th Commit
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
<div class="site-section">
|
||||
<div class="container">
|
||||
<div class="row mb-5">
|
||||
<form class="col-md-12" method="post">
|
||||
<form class="col-md-12" method="post" id="f1">
|
||||
<div class="site-blocks-table">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
@@ -152,7 +152,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="row mb-5">
|
||||
<div class="col-md-6 mb-3 mb-md-0">
|
||||
<button class="btn btn-primary btn-sm btn-block">Update Cart</button>
|
||||
<button id="b2" class="btn btn-primary btn-sm btn-block">Update Cart</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-outline-primary btn-sm btn-block">Continue Shopping</button>
|
||||
@@ -181,22 +181,6 @@
|
||||
</div>
|
||||
{% var total = 0.0 %}
|
||||
{% for (id, product) in products.pairs() %}
|
||||
{# <div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<span class="text-black">Subtotal</span>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<strong class="text-black">$230.00</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-md-6">
|
||||
<span class="text-black">Total</span>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<strong class="text-black">$230.00</strong>
|
||||
</div>
|
||||
</div> #}
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
@@ -229,6 +213,28 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
document.getElementById("b2").onclick = function() {
|
||||
const form = document.getElementById('f1');
|
||||
const formData = new FormData(form);
|
||||
|
||||
{% for (id, product) in products.pairs() %}
|
||||
formData.append("{{product.id}}_quantity", document.getElementById("{{product.id}}_quantity").value);
|
||||
document.cookie = "{{product.id}}_quantity="+document.getElementById("{{product.id}}_quantity").value;
|
||||
{% endfor %}
|
||||
|
||||
{# document.getElementById("f1").submit(); #}
|
||||
|
||||
fetch('/update-cart', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
{# location.reload(); #}
|
||||
window.location.href = '/update-cart';
|
||||
{# document.getElementById("f1").submit(); #}
|
||||
{# .then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
}) #}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user