AJAX in conjunction with partials


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
equivalent to Ajax.Updater(‘myDiv’, …)

If not, why not?

Does the Ajax.Request call just “throw away” the response?

Thanks for any help,
Wes G.

On Mar 20, 2006, at 7:49, Wes G. wrote:

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:


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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs