doudihuang7642 2015-06-17 09:08
浏览 119
已采纳

在ajax调用后,dropzone不显示表单

I'm using dropzone and I came to a problem that the dropzone does not detect the form after my ajax call. In the success of the ajax I tried to add Dropzone.discover(); after I put the form.

Ajax call:

$.ajax({
  type: 'POST',
  url: 'https://xxxxxxx/?controller=Sellers&action=showAllProducts',
  data: postData,
  success: function (data) {
    $('#showProducts').html(data);
    Dropzone.discover();
  },
  error: function (error) {
  }

});

The data:

<div class="container-fluid">
  <div class="row">
    <?php
      foreach($products as $product){
    ?>
    <!--HTML starts here!!!-->
    <div class="col-md-3 col-sm-4" style="width:358px; height:676px;">
      <?php echo '<form action="app/public/templates/control_panel/upload.php"
class="dropzone"
id="myDropzone">
</form>';?>
      <!--HTML ends here!!!-->
    </div>
    <?php
}

echo '</div>';
echo '</div>';

Now I know that the dropzone is working because when I put the form directly on the page, it works like it should. I think the problem is my forms are coming after the dropzone is fired, but I tried so many things and nothing has worked.

  • 写回答

1条回答 默认 最新

  • dongquanlin1885 2015-06-17 09:31
    关注

    Well, to use the discover function you must set the autodiscover to be false before you call the Dropzone.discover().

    After that, you can call Dropzone.discover() in the ajax success.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM