В моем приложении rails у меня есть эти два link_to
, которые оба явно что-то делают. Когда яRails Javascript Link_tos
<% if Excont.where(:user_id=> current_user,:movie_id => @movie.id,:actionall => '2').includes(:user).all.count == 0%>
<tr style="border-top: none; ">
<td>
<%= link_to('Mark as action', {:controller => :excont, :action => 'thisisanaction', :id=> @movie.id, :actionall=>'2'}, :method => :post, :remote => true, :disable_with => 'Updating...') %>
</td>
</tr>
<% else %>
<tr style="border-top: none;">
<td>
<%= link_to('Unmark as action', {:controller => :excont, :action => 'removethisisanaction', :id=> @movie.id, :actionall=>'2'}, :method => :post, :remote => true, :disable_with => 'Updating...') %>
</td>
</tr>
<% end %>
Когда я нажимаю на первом link_to
(thisisanaction), он запускает Updating...
, а затем возвращается к Mark as action
, если я перезагрузить это будет измениться на Unmark as action
.
Что я спрашиваю, как перейти от
Mark as action
->Updating...
->Unmark as action
, а затем
Unmark as action
->Updating...
->Mark as action
без перезагрузите страницу. Как бы мой JS код выглядеть