View Single Post
Old Oct 22nd, 2006, 1:06 PM   #1
matthewvb
Newbie
 
matthewvb's Avatar
 
Join Date: Sep 2006
Posts: 23
Rep Power: 0 matthewvb is on a distinguished road
Send a message via AIM to matthewvb
controllers & AJAX

I have a controller that renders a partial which looks like this: (traditional rendering)

render :partial => "feed", :object => @feed

question is: how can I call this method from the view and implement some cool AJAX where I get a loading spinner while the text is rendering then loads all at once?

I can do it with a form with this code:

<%= form_remote_tag :url => {:action => 'view'}, 
   :update => 'feed', :complete => visual_effect(:blind_down, 'feed'), 
   :before => %(Element.show('spinner')),
   :success => %(Element.hide('spinner')) %>

but i can't figure out how to implement the same type of comments when just calling the controller instead of having to use a form or a link (link_to_remote) in order access the content.

i'd be open to doing away with the controller and just having all the code in the view area, but i'm still looking to have the AJAX before/success elements implemented.

Thanks in advance for the help!
-matthew
__________________
matthewvb
www.matthewvb.com
matthewvb is offline   Reply With Quote