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 ssh登录页面的问题
  • ¥60 渗透一个指定银行app,拿到客户信息,需要什么级别
  • ¥50 关于在matlab上对曲柄摇杆机构上一点的运动学仿真
  • ¥15 jetson nano
  • ¥15 :app:debugCompileClasspath'.
  • ¥15 windows c++内嵌qt出现数据转换问题。
  • ¥20 公众号如何实现点击超链接后自动发送文字
  • ¥15 用php隐藏类名和增加类名
  • ¥15 算法设计与分析课程的提问
  • ¥15 用MATLAB汇总拟合图