RJS not sent as text/javascript


#1

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.


#2

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:

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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

_Kevin


#3

Steve R. 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.


#4

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.