On Fri, Jul 10, 2015 at 10:03 PM, David Williams <li...@ruby-forum.com> wrote:
> I'm in need of the AJAX method that allows a person to follow without > rendering a view. > Initially you wanted to use a `link_to` to display the link someone would click on to indicate they wanted to follow someone. <%= link_to 'Follow', follow_user_path(@user), class: 'button success > radius small' %> You'll need to change this into an AJAX request rather than a link_to. You could probably use `button_tag` but you'll still need to write the actual AJAX JavaScript code yourself for it. It's pretty straight-forward in jQuery, attaching a callback to the click event on the button, and the callback function does the AJAX request. On the server side, if you really wish to render nothing at all, `render nothing: true` will do that. See < http://guides.rubyonrails.org/layouts_and_rendering.html#using-render>. -- 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+unsubscr...@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/CAHUC_t-i7pv1MrSukUfzk8j45TJXi9pUwZwBGcj9Uhkk%3DzNXSA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.