Forum: Ruby on Rails AJAX in conjunction with partials

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-03-20 07:49
All,

Trying to clear up some confusion on my part.

If I make an Ajax call using Ajax.Request and in the controller method
that I call, I do a render (:partial => 'whatever.rhtml'), should I
expect that 'whatever.rhtml' will be rendered in the browser or not?

Put another way, is it in any way reasonable for me to think that
Ajax.Request + partial render of "myDiv" in the Ajax controller target
is
equivalent to Ajax.Updater('myDiv', ...)

If not, why not?

Does the Ajax.Request call just "throw away" the response?

Thanks for any help,
Wes Gamble
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2006-03-20 09:35
(Received via mailing list)
On Mar 20, 2006, at 7:49, Wes Gamble wrote:

> is
> equivalent to Ajax.Updater('myDiv', ...)

"Partials" are a mean to build views in the server, they do not use
layouts, they follow some name conventions, etc., but they ultimately
generate the same content regular RHTML templates do.

You could implement Ajax stuff calling an action that renders a
regular RHTML template with :layout => false. No difference from the
user's perspective.

Now for the Javascript, Ajax.Request does not update anything per se,
unless you do something by hand in the callbacks:

     http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request

It just issues a call to the server.

Additionally, one rarely writes those Javascript snippets by hand,
they are normally generated by helpers in Rails.

-- fxn
This topic is locked and can not be replied to.