# NEED HELP dieing here

**URL:** <https://www.ruby-forum.com/t/need-help-dieing-here/130867>\
**Category:** Rails\
**Created:** [March 4, 2008, 1:21am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867 "2008-03-04T01:21:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 1:21am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/1 "2008-03-04T01:21:38Z")

</div>

When I try and use rjs rails just outputs the text of the javascript I  
am trying to call with page.call

javascript is enabled, I have tried setting  
config.action\_view.debug\_rjs to false and commenting it out in the  
development environment. I have created a new app with no other  
javascript libraries and just tried to use rjs to call a simple  
javascript function. I have the include defaults tag in the layout.

In Firebug it says

```
try { } catch (e) { alert('RJS error:\n\n' +

e.toString()); alert(’ \<SCRIPT type=“text/javascript”\>  
\nmyfunction(“pics\\test1.jpeg”);\n '); throw e }
```

what is this pre thing, and why won’t it just call the javascript.  
This is killing me either there is some configuration everyone knows  
about that isn’t posted anywhere or I haven’t come across a tutorial  
that shows it or this is a bug in rails. Please help

trying  
def index  
@images = Image.find(:all)  
render :update do |page|  
page \<\< ’ ’  
end  
#render :index  
end

have tried redirecting to an action with the render stuff, the page  
still only has that

```
thing in the body.

the layout looks like:

Your title
    
    
    
    
      function myfunction(src)
```

---

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 1:27am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/2 "2008-03-04T01:27:29Z")

</div>

On Tue, Mar 4, 2008 at 11:21 AM, sweiss [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In Firebug it says
> 
> charset=UTF-8" /\>
> 
> Your title function myfunction(src) \>

Hi sweiss

Make sure in your layout you have the script tags to load prototype.

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

HTH  
Daniel

---

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 1:39am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/3 "2008-03-04T01:39:12Z")

</div>

On Tue, Mar 4, 2008 at 11:33 AM, sweiss [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Your title \<%= yield :layout %\> \>

Don’t know then sorry… Is it safe to use prototype and mootools in the  
same app?

Cheers

---

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 1:49am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/4 "2008-03-04T01:49:45Z")

</div>

I heard that it wasn’t, and the thing to make the compatible was to  
replae the $ in moo tools with something else so that symbol wouldn’t  
conflict, I tried that. I also created an empty app that did not have  
moo tools in it, just to try and call a javascript function with rjs,  
and it keeps on printiong out the text of what it should be making  
call as a function.

I know prototype is being used since it parses in the try{… catch  
(rjs error stuff, just don’t know why it doesn’t actually execute the  
code

---

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 10:33am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/5 "2008-03-04T10:33:43Z")

</div>

On 4 Mar 2008, at 00:21, sweiss wrote:

> end  
> #render :index  
> end

You don’t need that . the thing that  
parses the response knows that it’s javascript to evaluate, so you’re  
asking the javascript interpreter to evaluate

which it can't since that's not legal javascript (you can see this from what firebug shows you). Remove the two page \<\< (and make sure that when you use link\_to\_remote you aren't using the :update option) and you should be ok. Fred

---

<div class="post-metadata">

**Author:** ![sweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/51bf81/32.png) [@sweiss](https://www.ruby-forum.com/u/sweiss)\
**Post date:** [March 4, 2008, 1:34am UTC](https://www.ruby-forum.com/t/need-help-dieing-here/130867/6 "2008-03-04T01:34:31Z")

</div>

I get the same thing, I had just coppied an old layout, the layout  
looks liek this:

 Your title \<%= javascript\_include\_tag :defaults %\> function myfunction(src) {}

```
</script>

```

 ![](https://www.ruby-forum.com/pics/master1.jpeg)

 \<%= yield :layout %\>
