# RJS problem for redirect from controller

**URL:** <https://www.ruby-forum.com/t/rjs-problem-for-redirect-from-controller/133846>\
**Category:** Rails\
**Created:** [April 4, 2008, 9:23am UTC](https://www.ruby-forum.com/t/rjs-problem-for-redirect-from-controller/133846 "2008-04-04T09:23:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![balavrscse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@balavrscse](https://www.ruby-forum.com/u/balavrscse)\
**Post date:** [April 4, 2008, 9:23am UTC](https://www.ruby-forum.com/t/rjs-problem-for-redirect-from-controller/133846/1 "2008-04-04T09:23:30Z")

</div>

I have one RJS file in which i am updating multiple multiple divs.if  
user loged in then i am render one page.if user not loged in i am  
rendering siginin form page.

# MY RJS file:step5.rjs

if session[:username]!=nil and session[:username]!=""

```
if @type=='compare'
  page << "$('step1_image').src =

```

‘/images/subpages/steps/step1\_off.gif’";  
page \<\< “$(‘step2\_image’).src =  
‘/images/subpages/steps/step2\_off.gif’”;  
page \<\< “$(‘step3\_image’).src =  
‘/images/subpages/steps/step3\_off.gif’”;  
page.replace\_html “step4”, :partial=\>“step5”  
page[‘step1’].hide  
page[‘step2’].hide  
page[‘step3’].hide  
page[‘step4’].show  
page[‘step\_details’].hide  
page[‘step\_rest’].hide  
else  
page.replace\_html “company\_page”, :partial=\>“step5”  
end  
else  
if @type==‘compare’  
page \<\< “$(‘step1\_image’).src =  
‘/images/subpages/steps/step1\_off.gif’”;  
page \<\< “$(‘step2\_image’).src =  
‘/images/subpages/steps/step2\_off.gif’”;  
page \<\< “$(‘step3\_image’).src =  
‘/images/subpages/steps/step3\_off.gif’”;

```
  page.replace_html "step4", :partial=>"compare_signin"
  page['step1'].hide
  page['step2'].hide
  page['step3'].hide
  page['step4'].show
  page['step_details'].hide
  page['step_rest'].hide
  else
  page.replace_html "company_page", :partial=>"compare_signin"
  end
end

```

here if user not loged in then the signin page will render.then if user  
enter his user name and password.then i have to show the step5 partial  
page again in the step4 place.but i couldn’t update the partial step5  
page.because i am redirecting action to step5 from contoller which is  
signin validation.so it goes to new page.but i need to update the step5  
page in the step4 div as i mentioned in the RJS.if user already loged in  
means it working perfectly.but in sigin only it giving problem there  
also problem is due to redirection.is there any other way to redirect.

my step5 action in controller is:

def step5  
render :action=\>‘step5’  
end

how i am calling the RJS is:

\<%=form\_remote\_tag(:complete=\>“eval(request.responseText);”,:url=\>{:controller=\>‘my\_controller’,:action=\>‘step5’})%\>

how can i do this if anybody know the solutions please let it me know.
