hello, in order to add some ajax-calls to a site, I did a little test. The problem is that the result of the javascript is rendered as text.
I use rails 3.1.12 In the view that contains a test link to trigger the javascript I have <td><%= link_to factuur.nummer, toon_facturen_path( :id => factuur.id, :format => :js, :remote => true) %></td> In the FacturenController.pm I have def toon logger.error( "toon....") @factuur = Factuur.find(params[:id]) respond_to do |format| format.js # toon.js.rjs end end The layout file starts with <!DOCTYPE html> <html> <head> <title>brieven- en facturenarchief</title> <%= stylesheet_link_tag "application" %> <%= javascript_include_tag :application %> <%= csrf_meta_tags %> </head> The rjs-file toon.js.rjs contains a simple test statement: page.replace_html( 'status', '<p>test</p>') When I follow the link, the following is rendered on the screen: Element.update("status", "<p>test</p>"); (which isn't exact the contents of the rjs) and the server says Started GET "/facturen/toon.js?id=1&remote=true" for 127.0.0.1 at Tue Mar 18 14:30:43 +0100 2014 Processing by FacturenController#toon as JS Parameters: {"id"=>"1", "remote"=>"true"} toon.... Factuur Load (1.0ms) SELECT "facturen".* FROM "facturen" WHERE "facturen"."id" = 1 LIMIT 1 respond_to.... Rendered facturen/toon.js.rjs (4.0ms) Completed 200 OK in 92ms (Views: 51.0ms | ActiveRecord: 1.0ms) However, the resulting page shows the text of toon.js.rjs in HTML-pre-tags In addition I can mention config/application.rb requires prototype-rails and app/assets/application.js contains the lines //= require prototype //= require prototype_ujs //= require effects //= require dragdrop //= require controls I am out of ideas. Can somebody help me out of this? thanks in advance, Ruud -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4d4fa7b9-a12a-49d9-8731-8c4e3482871c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.