Link to home
Start Free TrialLog in
Avatar of weekapaug
weekapaug

asked on

Trying to redirect after event in javascript

I'm using dropzone, a multi-file uploader.

Read through the documents that says there is a queuecomplete special event.

I found this information:

Special Events: Queuecomplete and this code to go with it

<script src="./path/to/dropzone.js"></script>
<script>
Dropzone.options.filedrop = {
  init: function () {
      this.on("queuecomplete", function (file) {
          alert("All files have uploaded ");
      });
  }
};
</script>

I put the above code on the page that has the form to submit and was expecting to see this alert go off when it was done but nothing happens.  So first off I need to figure out if I'm putting it in the right spot, or why it doesnt work.  And once I can get this to work, I need to redirect to a page rather than just setting off a popup window.

Thanks, I'm new to javascript and feel like I'm missing something very basic.  I did change the directory of the script and everything else works fine with the uploads its only the queuecomplete event I can't seem to hook in with.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weekapaug
weekapaug

ASKER

Thank you Julian my issue was I didnt name the ID of the form the same as the function ID.  I didnt realize there was another variable to put in.

Could you tell me what the code is to redirect instead of alert?
this.on("queuecomplete", function (file) {
          window.location = "http://somewhere.interesting.and.useful.com";
      });

Open in new window