AJAX & Posting Reccomendation


#1

I’m currently developing a photo gallery website with Rails. Each photo
can be commented upon. What I’d like to do is, once the user posts a
comment, use AJAX to submit the comment and then automatically update
the page with the comment the user just submitted.

I also don’t want to use Prototype or the built in AJAX that comes with
Rails… it’s too fat for what I need. I can write the javascript to
handle this without a problem.

If this were in PHP/Perl, I’d just use javascript to post the data to a
php/cgi file. However, I’m a little unsure of the best way to approach
this with Rails. Would I create a controller just for this?
myurl.com/photos/addcomment and post to that controller… or?

Any suggestions?

Thanks in advance
tyler


#2

You don’t need separate controller - action in existing controller is
enough. Just make sure that action does not use layouts and only
responds
with the required data that can be processed by javascript