On Jan 4, 8:29 pm, shungite <jsni...@gmail.com> wrote:
> I have successfully rendered partials on the page, even in a toggling
> div (will use that later), but don't know whether I need  to use a
> Rails procedure, or prototype, or jquery or what. Sorry to be such a
> newbie, but any help would be greatly appreciated.  I really have
> tried to read about this. Thanks -- Jon .

There are two ways you could do this. Either everything is already on
the page (but hidden), or you fetch stuff from your server on demand.

In the first case all the detail html is rendered in the html, but
with a style that causes it not to be displayed. When you click on an
appropriate bit of the page, you run some javascript that hides
anything currently displayed and displays the bit for the thing just
clicked. You could write all that javascript yourself, but you'd be
mad not to use a library that makes things really easy and covers up
browser specific hacks. Jquery and prototype are two such libraries,
I'd suggest you take a look at the sites for both to see what you like
the look of (Jquery is incredibly nifty for dom manipulation in my
opinion).

In the second case when you click on the appropriate thing, an ajax
request is made to your server which returns the little bit of html
that should be displayed. Rails will give you a leg up here. If you
pass :remote => true to the link_to method (and if you load the
rails.js stuff which provides rails' glue) the clicks on such links
fire off ajax requests. There's a bunch of tutorials about this, one
that turned up high in a google search was
http://net.tutsplus.com/tutorials/javascript-ajax/using-unobtrusive-javascript-and-ajax-with-rails-3/

Fred

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to