07 2022 档案

摘要:1 请求体中的认证 传统的form认证 <form method="post" novalidate> {% csrf_token %} <input type="text"> <input type="submit" value="登录"> </form> jquery+ajax中携带认证 2 请 阅读全文
posted @ 2022-07-27 14:23 角角边 阅读(34) 评论(0) 推荐(0) 编辑
摘要:发送ajax: $.ajax({ url: "xxx", type: "GET", data: {}, dataType: "JSON", success: function(res) {}, }) 参数详解url: url:"/xx/xx/" && "{% url 'Login' %}" 参数详解 阅读全文
posted @ 2022-07-27 11:56 角角边 阅读(480) 评论(0) 推荐(0) 编辑
摘要:class封装返回值 常见的我们返回值都是{"xx": "xx", },其实我们可以优化返回值,通过class封装。 from django.http import JsonResponse class Response(object): def __init__(self): self.statu 阅读全文
posted @ 2022-07-26 17:58 角角边 阅读(16) 评论(0) 推荐(0) 编辑
摘要:前后端不分离模式,如何取到csrftoken 方式1: 导入一下js文件: // 根据cookie的name获取对应的值 function getCookie(name) { let cookieValue = null; if (document.cookie && document.cookie 阅读全文
posted @ 2022-07-26 15:44 角角边 阅读(73) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示