TypeError:$(...)。dropzone不是函数

时间:2019-05-12 11:50:51

标签: django dropzone.js

我想在我的Django应用中使用dropzone,我遵循了很多示例,但没有一个对我有用 你能帮我吗

Js代码:

     <script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
      <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.css" rel="stylesheet" type="text/css" />
      <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.js" type="text/javascript"></script>
      <script type="text/javascript">
      Dropzone.autoDiscover = false;
        $(document).ready(function(){
            $('#myDropzone').dropzone({
                url: "{% url 'dashboard/import' %}",
                addRemoveLinks: true,
                success: function (file, response) {
                    console.log("Successfully uploaded");
                },
                error: function (file, response) {
                    console.log("something goes wrong");
                }
            });
     });
     </script>

HTML代码:

<form action="{% url 'dashboard/import' %}" class="dropzone">
     {% csrf_token %} 
</form>

我遇到了TypeError:$(...)。dropzone不是函数

2 个答案:

答案 0 :(得分:0)

尝试一下:

  ax = sns.violinplot(x="Week_Number", y="Ammonia", data=Res)

答案 1 :(得分:0)

通过查看相关的javascript文件,函数名称dropzone以大写字母开头。因此,请尝试使用大写的函数,如下所示:

 $(document).ready(function(){
        $('#myDropzone').Dropzone({
            url: "{% url 'dashboard/import' %}",
            addRemoveLinks: true,
            success: function (file, response) {
                console.log("Successfully uploaded");
            },
            error: function (file, response) {
                console.log("something goes wrong");
            }
        });