# Using the same action in AJAX calls

**URL:** <https://www.ruby-forum.com/t/using-the-same-action-in-ajax-calls/88006>\
**Category:** Rails\
**Created:** [March 7, 2007, 2:53pm UTC](https://www.ruby-forum.com/t/using-the-same-action-in-ajax-calls/88006 "2007-03-07T14:53:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f17d59/32.png) [@Nicholas\_W](https://www.ruby-forum.com/u/Nicholas_W)\
**Post date:** [March 7, 2007, 2:53pm UTC](https://www.ruby-forum.com/t/using-the-same-action-in-ajax-calls/88006/1 "2007-03-07T14:53:34Z")

</div>

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 request.post? 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 ?

ngw
