CulturalMe/meteor-slingshot

How to view an image with the callback function

Opened this issue · 0 comments

I can't seem to figure out how to make use of the returned values from the callback in the DOM.

  'drop #dropzone' : function(e, t) {
    e.preventDefault();
    $(e.currentTarget).addClass('dropped');
    droppedFiles = e.originalEvent.dataTransfer.files;
    S3.upload({
      files:droppedFiles,
    },function(e,r){
      data = r.secure_url;
    });
  },

I'd like to use the returned image url in the DOM by appending it to an element like this:

 $img = $('<img />').attr('src', data).fadeIn();
 $(e.currentTarget).append(img)

The issue is with the scopes, is there a method or way to get the return value outside the call back function?

Thanks!