Add CSRF token to ajax requests
This commit is contained in:
parent
a6f22b2a03
commit
bf16632f89
@ -17,6 +17,13 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$.ajaxSetup({beforeSend: function(xhr, settings){
|
||||||
|
xhr.setRequestHeader('X-CSRFToken',
|
||||||
|
'{{ csrf_token }}');
|
||||||
|
}});
|
||||||
|
</script>
|
||||||
|
|
||||||
{{ form.media }}
|
{{ form.media }}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
|
Loading…
Reference in New Issue
Block a user