Strange RJS behavior

I used RJS extensively in my last web app with no problem.

I’m just beginning a new one and having a very odd problem.

The called method, get_names, retrieves some values from the database,
then ends:

render :layout => false

the get_names.rjs file is rendered into Javascript, but then is just
dumped as Javascript (text) into the browser:

e.g:

try {
Element.update(“this_panel”, “”);
new Insertion.Bottom( … );
} catch (e) { alert(‘RJS error:\n\n’

Any ideas?

Thanks!

Does the link_to_remote by any chance have an :update => ‘this_panel’ in
it ? That would take the reuslt of the Ajax call and update the div.
I often make this mistake if I start with an update and replace it with
RJS.

Alan

Chris H. wrote:

the get_names.rjs file is rendered into Javascript, but then is just
dumped as Javascript (text) into the browser:

Alan F. wrote:

Does the link_to_remote by any chance have an :update => ‘this_panel’ in
it ? That would take the reuslt of the Ajax call and update the div.
I often make this mistake if I start with an update and replace it with
RJS.

Alan

Chris H. wrote:

the get_names.rjs file is rendered into Javascript, but then is just
dumped as Javascript (text) into the browser:

Alan–no it’s just this:

		<%= form_remote_tag :url => { :controller => "name", :action => 

“get_name”} %>
Enter your name:
<%= text_field “name_input”,“name”, :size => 20 %>
<%= end_form_tag %>

Chris H. wrote:

  		<label for="name_input">Enter your name:</label>
  	        <%= text_field "name_input","name", :size => 20 %>
  	<%= end_form_tag %>

Can you paste your .rjs file? Like Alan I have seen this before when
setting :update but since you are not doing that the problem may be in
the rjs.

Matthew M.
blog.mattmargolis.net

Alan F. wrote:

Can you paste your .rjs file? Like Alan I have seen this before when
setting :update but since you are not doing that the problem may be in
the rjs.

One other problem might be content type. If you copy the code from the
rjs into the action and use render :update instead, does it work there ?

Codefluency.com

A.

Also, did you remember to add the javascript tags to the layout ?

A.

Can you paste your .rjs file? Like Alan I have seen this before when
setting :update but since you are not doing that the problem may be in
the rjs.

One other problem might be content type. If you copy the code from the
rjs into the action and use render :update instead, does it work there ?

http://codefluency.com/articles/2006/05/27/rails-views-render-update-not-rjs/

A.