Rails AJAX ERB View Question link_to_remote

Als 3.0

My question is using link_to_remote to call ajax.

2.3.8 Ajax call

<%= link_to_remote image_tag("../images/services_button.jpg", :mouseover => 
    "../images/services_button_over.jpg"), :url =>{:controller => :dashboard, :action => :service} %>

Current view -

<% link_to_remote view_path do %>
            About Us<span>Who we are</span>
<% end %>

How do I turn the current view code into an ajax call? I tried something like this ...

<% link_to_remote "hello", :url=>{:controller=>:sae,:action=>:bam} do %>
            About Us<span>Who we are</span>
      <% end %>

Thanks for your help in advance.

Trying to make core ... core .. UJS.

A very simple AJAX call to make a div. Although it does not work. Trying to upgrade from 2.3.8 to 3.0. Any help is appreciated. I googled, although I cannot understand the meaning of jargon. :( Thanks in advance

View:

<div class="test">
  Whompa
</div>
<%= link_to 'Blind-Up', :controller=>:home,:actions=>:test, :remote =>true %>

Controller:

  def test
    render :update do |page|
      page[:test].visual_effect :blind_up
    end
  end
+3
source share

Source: https://habr.com/ru/post/1765236/


All Articles