How to :update after :success with link_to_remote Rails method?
- by Kevin
Hi,
I'm trying to get two things done after a user clicks on a link:
Delete a div
Add another element at the bottom of the page
I played with Rails link_to_remote and what I get with the code below is that the element is added before the div is deleted:
<%= link_to_remote "✓",
:url => {
:controller => :movies,
:action => :mark_as_seen,
:movie => movie,
:render => 'movie' },
:success => "Effect.Fade('movie_#{movie.id}_wrapper', { duration: 0.4 })",
:update => "movies", :position => "bottom",
:failure => "alert('Ooops! An error occurred.')"
%>
I tried to put :update and :position in a :complete callback, but nothing happened. And when I put both of them in the :success callback (after Effect.Fade), all I get is a parsing error.
Any idea?
Thanks,
Kevin