Macray
Macray

Reputation: 31

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

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!

Upvotes: 3

Views: 2475

Answers (2)

Abhishek
Abhishek

Reputation: 5728

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();
});

Upvotes: 11

Ravi Gadag
Ravi Gadag

Reputation: 15861

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.');
});

Upvotes: -1

Related Questions