title: Ajax record delete not appended to HTML
body: <p>I am venturing into AJAX and would like to delete a record of a model and followed this thread : <a href="https://stackoverflow.com/questions/31129766/how-to-perform-controller-destroy-action-asynchronously-in-rails">How to perform Controller.destroy action asynchronously in rails?</a></p>
  
  <p><strong>models:</strong> </p>
  
  <pre><code>Photographe
  Photographephoto
  </code></pre>
  
  <p><strong>views/photographes/edit.html.erb</strong></p>
  
  <pre><code>&lt;div id="sectionimages" class="gutter-0 row" &gt;
            &lt;% @photographe.photographephotos.all.each do |f| %&gt;
                &lt;div class="col-md-2 col-sm-3 col-xs-6 col"&gt;
                  &lt;%= link_to professionnel_photographe_photographephoto_path(@photographe.professionnel.id,@photographe.id, f.id), method: :delete, remote: 'true', id: "destruction"+f.id.to_s do %&gt;
                      &lt;div class="killimage"  &gt;
                        &lt;%= image_tag f.image.url(:small) %&gt;
                        &lt;%= image_tag 'fatcrosswhite.svg', class: 'imgover' %&gt;
                      &lt;/div&gt;
                  &lt;% end %&gt;
                &lt;/div&gt;
            &lt;% end %&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>link to <code>Photographephotos#destroy</code> is <code>remote</code> and there's an <code>id</code> like "destruction134"</p>
  
  <p><strong>photographephotos_controller.rb</strong></p>
  
  <pre><code>def destroy
  
        @imagedestroyed = Photographephoto.find(params[:id])
        @imagedestroyedid = @imagedestroyed.id
        @imagedestroyed.image = nil
        @imagedestroyed.save
        @imagedestroyed.destroy
  
        respond_to do |format|
          format.js
        end
  
  end
  </code></pre>
  
  <p><strong>views/photographephotos/destroy.js.erb</strong></p>
  
  <pre><code>var destroyelement = document.getElementById("&lt;%= "destruction"+@imagedestroyedid.to_s %&gt;");
  destroyelement.parentNode.remove();
  </code></pre>
  
  <p>Problem is the file is indeed deleted but I have to refresh the page to see it removed. It seems the javascript is not effective. (I am trying to remove the parent of the link which is a Bootstrap DIV)</p>