Monday videos: AJAX in Django
Posted on Oct 26th, 2020
Post-video note
By the end of class we had gotten as far as getting a 403 request from our Django application. The solution is to add the following to our AJAX request:
headers: { "x-csrftoken": form.elements["csrfmiddlewaretoken"].value },
This ensures that the token generated by csrf_token
is included in the request (when you
submit a form normally django knows how to handle it, but when you send an AJAX request this
needs to be specified).
Video Links
- Morning Video
- Password: 0*nMSN^.
- Afternoon Video
- Password: 4jV8+!9k