Add CSRF token to ajax requests

This commit is contained in:
Zakary Timson 2018-01-25 01:47:42 -05:00
parent a6f22b2a03
commit bf16632f89

View File

@ -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 %}