Using the same action in AJAX calls

Hi *,
I display a form after a link_to_remote where I edit some object attributes. Actually I need 2 controller actions, edit (this one displays the form) and do_edit (this one changes the attributes in the db). I'd like to do the same thing I do for normal non-AJAX actions with to use the same action (in my case 'edit') for both, in one case render a partial in the other update the db and render a partial, or fail the update and redisplay the remote_form_for.
They are both request.xhr? AFAIK, so actually I don't know how to solve this one ...
Someone already tried ?