• Uncaught TypeError: $.cookie is not a function at <anonymous>:1:3前端页面内调试台bug


    1.报错信息:

    原因在jquery.js中没有引入jquery.cookie.js,HTML代码:

     1 {% load static %}
     2 <!DOCTYPE html>
     3 <html lang="en">
     4 <head>
     5     <meta charset="UTF-8">
     6     <title>Login</title>
     7 </head>
     8 <body>
     9 <form action="{% url 'login' %}" method="post"><!--url指定提交数据地址,待校验数据的def-->
    10     {% csrf_token %}<!--通过csrf认证机制-->
    11     用户名:<input type="text" name="username">
    12     密 码:<input type="password" name="password">
    13     <input type="submit" value="提交">
    14 </form>
    15 <script src="{% static 'jquery-3.4.1.js' %}"></script>
    16 </body>
    17 </html>

    2.在jquery后引入juqery.cookie.js

     1 {% load static %}
     2 <!DOCTYPE html>
     3 <html lang="en">
     4 <head>
     5     <meta charset="UTF-8">
     6     <title>Login</title>
     7 </head>
     8 <body>
     9 <form action="{% url 'login' %}" method="post"><!--url指定提交数据地址,待校验数据的def-->
    10     {% csrf_token %}<!--通过csrf认证机制-->
    11     用户名:<input type="text" name="username">
    12     密 码:<input type="password" name="password">
    13     <input type="submit" value="提交">
    14 </form>
    15 <script src="{% static 'jquery-3.4.1.js' %}"></script>
    16 <script src="{% static 'jquery.cookie.js' %}"></script>
    17 
    18 </body>
    19 </html>
  • 相关阅读:
    MySQL-percona安装
    Oracle-19C PSU升级
    Oracle-内存管理机制
    学习进度第十二周
    十天冲刺10
    单词统计续
    十天冲刺9
    学习进度第十一周
    十天冲刺8
    十天冲刺7
  • 原文地址:https://www.cnblogs.com/Zhao159461/p/10969880.html
Copyright © 2020-2023  润新知