# Render :update working incorrectly

**URL:** <https://www.ruby-forum.com/t/render-update-working-incorrectly/100297>\
**Category:** Rails\
**Created:** [July 28, 2006, 6:16am UTC](https://www.ruby-forum.com/t/render-update-working-incorrectly/100297 "2006-07-28T06:16:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [July 28, 2006, 6:16am UTC](https://www.ruby-forum.com/t/render-update-working-incorrectly/100297/1 "2006-07-28T06:16:35Z")

</div>

I have the following code

render :update do |page|  
page.alert(‘Hey there’)  
end

Why is it taking me to a blank page with the following text at the top:

alert(“Hey there”);

This text is in

```
tags as well. Its kinda weird. Thats what I want
to execute on the page that it came from. Any ideas?

This happens with the other commands where it renders the javascript for  
the command than puts that javascript on a blank page.
```

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [July 28, 2006, 6:23am UTC](https://www.ruby-forum.com/t/render-update-working-incorrectly/100297/2 "2006-07-28T06:23:43Z")

</div>

On 7/28/06, Eric G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> alert(“Hey there”);  
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

How are you calling this? is it with link\_to\_remote or within a  
form\_remote\_tag

If you just put it straight into a link\_to then it will redirect you to  
a  
new page and display the results of the action.

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [July 28, 2006, 8:22am UTC](https://www.ruby-forum.com/t/render-update-working-incorrectly/100297/3 "2006-07-28T08:22:14Z")

</div>

well, i didnt have the form\_remote\_tag so I put it in. I now have

\<%= form\_remote\_tag(:html=\> {:id=\> “signup\_form”},:url =\> { :action =\>  
:tester }) %\>

as my form tag. The method is as follows:

def tester  
render :update do |page|  
page.insert\_html(:after, ‘sport1’, ‘ **working** ’)  
end  
end

Again, I still get “new Insertion.After(“sport1”, “ **working** ”);”

on a blank page. What am I doing wrong. I have no plugins installed  
either that might conflict.

> How are you calling this? is it with link\_to\_remote or within a  
> form\_remote\_tag
> 
> If you just put it straight into a link\_to then it will redirect you to  
> a  
> new page and display the results of the action.

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [July 28, 2006, 8:32am UTC](https://www.ruby-forum.com/t/render-update-working-incorrectly/100297/4 "2006-07-28T08:32:22Z")

</div>

On 7/28/06, Eric G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> render :update do |page|
> 
> > 
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Do you have a layout definied with

\<%= javascript\_include\_tag :defaults %\>

It sounds like you don’t have the prototype.js file loaded into your  
page.  
The prototype file is the default set of scripts that provides ajax  
functionality. You will need to include them
