☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
⭐Top resource to learn Python - https://datacamp.pxf.io/kOjKkV ⭐
In this video, we'll learn about sending the CSRF Token alongside AJAX POST requests in Django applications, as well as with HTMX.
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
01:52 Sending AJAX POST request when button is clicked
03:38 Adding data attribute to HTML button element
05:37 Sending fetch() request
07:54 Sending CSRF Token in AJAX request
11:03 Updating Django view for AJAX request
12:26 HTMX and CSRF Tokens
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Django CSRF & AJAX: https://docs.djangoproject.com/en/5.1...
Data Attributes: https://developer.mozilla.org/en-US/d...
#python #django #webdevelopment #htmx