The Dropzone is not working after Jquery .load() execute

寵の児 提交于 2020-01-23 01:40:27

问题


Hi can you help me to make a solution about my problem?

This is my code:

$(document).ready(function() {      
        $('#sample').load('sample.html')
});

after the script execute and the sample.html is now loaded where my...

<form action="upload.php" class="dropzone"></form>

is located the dropzone js is not working.

Please help me about this issue . I can't figured how to make a solution for this.

Thanks!


回答1:


You need to tell dropzone to reparse the document. If you using jquery.load method Also only use Dropzone.discover method after uploader is fully loaded.

$('#sample').load('sample.html', function() {
  Dropzone.discover();
});



回答2:


you need to use the $.getScript method to load the JS file.. getScript

$.getScript("yourJsPath", function(data, textStatus, jqxhr) {
   console.log(data); //data returned
   console.log(textStatus); //success
   console.log(jqxhr.status); //200
   console.log('Load was performed.');
});


来源:https://stackoverflow.com/questions/17986496/the-dropzone-is-not-working-after-jquery-load-execute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!