# RJS show as 'try...' in AJAX update

**URL:** <https://www.ruby-forum.com/t/rjs-show-as-try-in-ajax-update/152814>\
**Category:** Rails\
**Created:** [November 7, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/rjs-show-as-try-in-ajax-update/152814 "2008-11-07T18:18:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuelzx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@samuelzx](https://www.ruby-forum.com/u/samuelzx)\
**Post date:** [November 7, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/rjs-show-as-try-in-ajax-update/152814/1 "2008-11-07T18:18:35Z")

</div>

Hi guys,

I am trying to display Javascript code after an Ajax call. It is  
executing the JS code, but it’s also displaying it. It shows as:

try {  
alert(…);  
} catch …  
…

my controller code:

render :update do |page|  
page.alert message\_var  
end

my Javascript code:  
new Ajax.Updater(“div\_id”, my\_controller\_url,  
{ asynchronous: true,  
evalScripts: true,  
method: ‘get’,  
parameters: query\_string  
}  
);

In the prototype documentation, it says AJax.Updater’s evalScripts will  
eval anything in tags, and they will not be displayed. Is there  
anyway to wrap RJS output’s in tags?

Or another way of solving this?

Much thanks  
Xin

---

<div class="post-metadata">

**Author:** ![samuelzx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4491bb/32.png) [@samuelzx](https://www.ruby-forum.com/u/samuelzx)\
**Post date:** [November 7, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/rjs-show-as-try-in-ajax-update/152814/2 "2008-11-07T18:26:07Z")

</div>

On 7 Nov 2008, at 17:18, Xin Z. wrote:

> ```
> method: 'get',
> parameters: query_string
> }
> 
> ```
> 
> );
> 
> In the prototype documentation, it says AJax.Updater’s evalScripts  
> will  
> eval anything in tags, and they will not be displayed. Is  
> there  
> anyway to wrap RJS output’s in tags?

Don’t use Ajax.Updater with render :update (just plain old  
Ajax.Request will do fine)

Fred
