On 16.6.2006, at 9.03, Ben Lisbakken wrote:
to correct myself, instead of<%= link_to "Link Here", :action => "register" %>i meant <%= link_to_remote("Link Here", :url => (:action => :register) %> On Jun 15, 2006, at 10:54 PM, Ben Lisbakken wrote:What are the differences between<a href="#" value="Register" onclick="<%= remote_function(:update => "title_login", :url => { :action => :register })%>;">Link Here</a>and using <%= link_to "Link Here", :action => "register" %> with register.rjs which contains the code page.replace_html "title_login", "blah blah blah"Are there any performance differences between using rjs vs. remote_function? What are the advantages/disadvantages?
You should never use the update parameter when using rjs templates. I'm not sure if you meant that, but you call the register action in the first example, too, so I just thought to mention that.
But let's say you knew that, and in the first case you just render a partial template from the register action. In your particular case, there's not much difference. In the first case, Ajax.Updater is used instead of Ajax.Request on the JS level, but if all you care about is to update a page element, that doesn't mean anything to you. In that case, the register action returns the partial rendered as text/html to the ajax call. In the rjs case, text/javascript is returned with the rjs commands interpreted to Javascript.
You start to get more advantage of the rjs templates when you want to do more complex things within the page, e.g. highlight one element, update a subtotal somewhere else on the page etc, etc. So in your case you can as well use the :update parameter. However, you can do that as well using link_to_remote, there is no need to write the anchor tag by hand there, either.
//jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Rails-spinoffs mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
