☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
ko-fi.com/bugbytes
⭐Top resource to learn Python - 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: bugbytes.io/posts/
👾 Github: github.com/bugbytes-io/
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Django CSRF & AJAX: docs.djangoproject.com/en/5.1/howto/csrf/#using-cs…
Data Attributes: developer.mozilla.org/en-US/docs/Learn_web_develop…
#python #django #webdevelopment #htmx
コメント