I''ve made a couple of other posts about this and finally figured out what was wrong. For some reason, the RJS response was not being sent with a content type of "text/javascript" (which it should be, per the dox). The following line in each controller method that renders RJS makes my app work: @headers[''Content-Type''] = ''text/javascript'' Does anyone know why the content type might not be getting set correctly? Thanks -- View this message in context: http://www.nabble.com/RJS-not-sent-as-text-javascript-t1495574.html#a4053568 Sent from the RubyOnRails Users forum at Nabble.com.
I think I encountered this problem when I rendered some partials to a string. That seems to set the content type, and subsequent renders don''t fix it. On Sunday, April 23, 2006, at 11:46 AM, s.ross wrote:> >I''ve made a couple of other posts about this and finally figured out >what was >wrong. For some reason, the RJS response was not being sent with a content >type of "text/javascript" (which it should be, per the dox). The following >line in each controller method that renders RJS makes my app work: > >@headers[''Content-Type''] = ''text/javascript'' > >Does anyone know why the content type might not be getting set correctly? > >Thanks >-- >View this message in context: http://www.nabble.com/ >RJS-not-sent-as-text-javascript-t1495574.html#a4053568 >Sent from the RubyOnRails Users forum at Nabble.com. > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails_Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Steve Ross wrote:> I''ve made a couple of other posts about this and finally figured out > what was > wrong. For some reason, the RJS response was not being sent with a > content > type of "text/javascript" (which it should be, per the dox). The > following > line in each controller method that renders RJS makes my app work: > > @headers[''Content-Type''] = ''text/javascript'' > > Does anyone know why the content type might not be getting set > correctly? > > Thanks > -- > View this message in context: > http://www.nabble.com/RJS-not-sent-as-text-javascript-t1495574.html#a4053568 > Sent from the RubyOnRails Users forum at Nabble.com.How exactly are you calling the rjs render? Just a pass-through (meaning no render statement)? using respond_to do |type|? Either of those methods should pass the proper header. Any other way of doing it would probably send the default html header. -- Posted via http://www.ruby-forum.com/.
It''s a pass-through and I''m at a loss to understand why the correct header is not being sent. I thought the :partial thing held some promise, but reduced it to render only the word ''hello, rjs'' and that didn''t work with me explicitly setting the headers. -- View this message in context: http://www.nabble.com/RJS-not-sent-as-text-javascript-t1495574.html#a4054012 Sent from the RubyOnRails Users forum at Nabble.com.