The Rails link_to helper includes the :method => :post option, which will invoke an unobtrusive JavaScript method to generate a form out of your link and send it that way.
Walter
On Apr 5, 2014, at 5:23 AM, Дмитро Бігняк wrote:
> May be you searched this?
> <%= link_to 'Search', "#", :onclick=>"$('.search_form').submit()" %>
>
>
> On Friday, April 4, 2014 7:10:22 PM UTC+3, Ruby-Forum.com User wrote:
> I have an empty form into a link. That is instead of having a button
> initiate a get request, do it with a link.
>
> The form looks like this:
>
> <%= form_tag somethpath(@data), method: get, :remote => true,
> :'data-attr' => @data.id do %>
> <%= submit_tag "Search" %>
> <% end %>
>
> Is there an equivalent way to do this using link_to ?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b32eb21c-e55b-4393-b080-0a8e5db40f1e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/EFF11910-7733-4C6A-AEDB-55BF2BF138FA%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment