21st Commit

This commit is contained in:
Aritra Banik 2024-02-08 03:06:35 +05:30
parent 72bee5e930
commit b2de899a3d

View File

@ -214,27 +214,12 @@
</div> </div>
<script> <script>
document.getElementById("b2").onclick = function() { document.getElementById("b2").onclick = function() {
const form = document.getElementById('f1');
const formData = new FormData(form);
{% for (id, product) in products.pairs() %} {% 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; document.cookie = "{{product.id}}_quantity="+document.getElementById("{{product.id}}_quantity").value;
{% endfor %} {% endfor %}
{# document.getElementById("f1").submit(); #}
fetch('/update-cart', {
method: 'POST',
body: formData
})
{# location.reload(); #}
window.location.href = '/update-cart'; window.location.href = '/update-cart';
{# document.getElementById("f1").submit(); #}
{# .then(response => response.json())
.then(data => {
console.log(data);
}) #}
} }
</script> </script>
{% endblock %} {% endblock %}