title: Dropzonejs, removes from server not from the page
body: <p>I am using dropzonejs and it works in the server, It saves and when I click on the remove button it removes from the server. But the only problem is, when I click to remove button the picture stays on the page. I think it is because of the jquery code. But I could not solve it.  </p>
  
  <p>Here ;</p>
  
  <pre><code>&lt;div class="container"&gt;
  
  &lt;%= form_for [@boat, @picture], html: { multipart: true, url: wizard_path, class: "dropzone", id: "picture-dropzone"} do |f| %&gt;
  
  
        &lt;p&gt;
  
        &lt;div class="fallback"&gt;
        &lt;%= f.file_field :image %&gt; 
  
        &lt;/div&gt;    
  
        &lt;/p&gt;
  
  &lt;% end %&gt;
  
  &lt;p&gt;&lt;%= link_to "Back to My Profile",  current_user %&gt;&lt;/p&gt;
  
  
  &lt;div class="index"&gt;
    &lt;%= render "index" %&gt;
  &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      // disable auto discover
      Dropzone.autoDiscover = false;
  
      // grap our upload form by its id
      $("#picture-dropzone").dropzone({
          // restrict image size to a maximum 5MB
          maxFilesize: 5,
          // changed the passed param to one accepted by
          // our rails app
          paramName: "picture[image]",
  
          acceptedFiles: "image/*", 
          // show remove links on each image upload
          addRemoveLinks: false,
          // if the upload was successful
          success: function(file, response){
              // find the remove button link of the uploaded file and give it an id
              // based of the fileID response from the server
              $(file.previewTemplate).find('.dz-remove').attr('id', response.fileID);
              $(file.previewTemplate).find('.dz-remove').attr('boat_id', response.boatID);
              // add the dz-success class (the green tick sign)
              $(file.previewElement).addClass("dz-success");
  
          },
          //when the remove button is clicked
          removedfile: function(file){
  
              // grap the id of the uploaded file we set earlier
              var id = $(file.previewTemplate).find('.dz-remove').attr('id'); 
              var boat_id = $(file.previewTemplate).find('.dz-remove').attr('boat_id'); 
              // make a DELETE ajax request to delete the file
              $.ajax({
              type: 'DELETE',
                  url: '/boats/' + boat_id + '/pictures/' + id,
                  success: function(file){
                   removeFile(file); // THIS DOES NOT WORK
  
                      //SOMETHING HERE
  
                  }
              });
          }
      }); 
  });
  
  
  
  &lt;/script&gt;
  </code></pre>