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.