Refreshing a div with preformated text

Hello,

Just would like to know how I can refresh a div with formatted text ( html code ) on user onclick action on menu items. I guess I could to this with prototype but should I use the link_remote_tag ? In my case there's no need to a make a remote ajax call to whatever controller action but only put pre-defined formatted text in a div.

Regards,

Joel

For the user onclick action you can use replace(). (or replace_html depending on whether you want to keep your div or not.)

Something like: <input type="button" value="Update" <%= "onclick=$(div_id).replace(<h1>Hello</h1>);" %>>

Hope this helps,

Alan

Have a look at link_to_function--that will write client-side javascript that doesn't bother the server.