Answers for "how to send csrf middleware token in django ajax"

0

django csfr token

<form action="{% url "submit-form-url-name" %}" method="post" accept-charset="utf-8">
    {% csrf_token %}
    {{ form.field1 }}
    {{ form.field2 }}
    ...
</form>
Posted by: Guest on September-20-2020
0

how to send csrf middleware token in django ajax

{% csrf_token %}
<script>
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
</script>
Posted by: Guest on December-08-2020

Code answers related to "how to send csrf middleware token in django ajax"

Code answers related to "Javascript"

Browse Popular Code Answers by Language