I have a Django App and I would like a message to appear to the user after a successful Ajax call. Here is my Messages HTML:
<a id="added" class="btn btn-template-outlined" href="{% url 'shop:add_product' id=products.id %}">Add to cart</a>
<p id="connt" class="text-center">
{% if messages %}
{% for message in messages %}
{{message}}
{% endfor %}
{% endif %}
</p>
And here is my Ajax script:
$("#added").click(function(e){
e.preventDefault();
$.ajax({url: "{% url 'shop:add_product' id=products.id %}",
success: function(response){
appendToUsrTable();
}});
});
function appendToUsrTable() {
("#connt").append(`
`)
}
</script>