# Periodically\_call\_remote renders Page in page

**URL:** <https://www.ruby-forum.com/t/periodically-call-remote-renders-page-in-page/186499>\
**Category:** Rails\
**Created:** [April 8, 2010, 2:21am UTC](https://www.ruby-forum.com/t/periodically-call-remote-renders-page-in-page/186499 "2010-04-08T02:21:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashwin\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@Ashwin\_V](https://www.ruby-forum.com/u/Ashwin_V)\
**Post date:** [April 8, 2010, 2:21am UTC](https://www.ruby-forum.com/t/periodically-call-remote-renders-page-in-page/186499/1 "2010-04-08T02:21:14Z")

</div>

I am using Periodically\_call\_remote in the following way

 \<%= periodically\_call\_remote( :update =\> "refresh", :frequency =\> 3, :url =\> { :action =\> :activate }) %\>

and the action i am calling is shown below. The activate action checks  
for some value in a remote database and once the value says Active  
then i want the user to be redirected to another page. But what is  
happening is that the new page is getting loaded inside the Div  
“refresh” tag. So its a page in page.

def activate  
—perform something—  
if ( Check = “active”)  
redirect to different page  
end  
end

Any idea how i can do rectify this. Any other suggestions are welcome  
too.

Ashwin

---

<div class="post-metadata">

**Author:** ![Ashwin\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@Ashwin\_V](https://www.ruby-forum.com/u/Ashwin_V)\
**Post date:** [April 8, 2010, 9:16am UTC](https://www.ruby-forum.com/t/periodically-call-remote-renders-page-in-page/186499/2 "2010-04-08T09:16:51Z")

</div>

First, I wouldn’t use the periodically\_call inside the refresh div. I  
have the feeling that it will vanish at the first call as it will be  
replaced by the content if the update.  
Anyway, if you want to redirect the user to another page, you cannot  
use redirect because the periodical just replace some portion of the  
page. So you have to use some JavaScript to tell the browser to change  
the page location.  
Put something like  
JavaScript\_tag window.location = new/location/whatever.  
You may have to check some option to make sure this piece of code will  
be evaluated.

Pardon my errors or typos, but Im on my mobile without access to  
reference material.  
You should find some info on periodacal on [www.prototypejs.org](http://www.prototypejs.org)

Good luck  
Christophe

Le 8 avr. 2010 à 02:19, Ashwin V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) a écrit :
