# Javascript momentarily displayed on screen?

**URL:** <https://www.ruby-forum.com/t/javascript-momentarily-displayed-on-screen/157022>\
**Category:** Rails\
**Created:** [January 6, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/javascript-momentarily-displayed-on-screen/157022 "2009-01-06T15:22:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gte351s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@gte351s](https://www.ruby-forum.com/u/gte351s)\
**Post date:** [January 6, 2009, 3:22pm UTC](https://www.ruby-forum.com/t/javascript-momentarily-displayed-on-screen/157022/1 "2009-01-06T15:22:07Z")

</div>

what could be a reason for my js to be displayed on the screen for a  
second before it catches and does what it’s supposed to? I’ve had this  
happen when I call page.reload inside render :update block…

\<%= link\_to\_remote ‘reload’,  
:update =\> ‘my\_div’,  
:url =\> {:action =\> ‘reload\_page’} %\>

def reload\_page

respond\_to do |format|  
format.js do  
render(:update) do |page|  
page.reload  
end  
end  
end

end

yup, rails newb.

---

<div class="post-metadata">

**Author:** ![gte351s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@gte351s](https://www.ruby-forum.com/u/gte351s)\
**Post date:** [January 6, 2009, 3:29pm UTC](https://www.ruby-forum.com/t/javascript-momentarily-displayed-on-screen/157022/2 "2009-01-06T15:29:29Z")

</div>

On 6 Jan 2009, at 14:22, Shilo A. wrote:

> what could be a reason for my js to be displayed on the screen for a  
> second before it catches and does what it’s supposed to? I’ve had this  
> happen when I call page.reload inside render :update block…

Don’t pass :update to link\_to\_remote if you’re using render :update

Fred

---

<div class="post-metadata">

**Author:** ![gte351s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@gte351s](https://www.ruby-forum.com/u/gte351s)\
**Post date:** [January 7, 2009, 10:04am UTC](https://www.ruby-forum.com/t/javascript-momentarily-displayed-on-screen/157022/3 "2009-01-07T10:04:30Z")

</div>

Frederick C. wrote:

> On 6 Jan 2009, at 14:22, Shilo A. wrote:
> 
> > what could be a reason for my js to be displayed on the screen for a  
> > second before it catches and does what it’s supposed to? I’ve had this  
> > happen when I call page.reload inside render :update block…
> 
> Don’t pass :update to link\_to\_remote if you’re using render :update
> 
> Fred

Right, that was the problem. Thanks.
