It sounds like you're not (telling Rails to) set the correct content
type. The response.responseJSON property is set if (and only if) the
content type of the response is "application/json" (or a synonym for
it). Otherwise, it's blank (null or undefined, I don't know which; I
would have said undefined except you said null in your note).
So: Ensure that your content is going out with the correct content
type, and Prototype will correctly interpret it.
I'm not a Rails-head (or Ruby-head, for that matter), so I'll just
throw this out in case it's useful: Prototype has special handling
built in (I suspect for Ruby or Rails) for a response header called X-
JSON. If an X-JSON header is present on the response, its contents
will be treated as JSON, deserialized, and made available as
response.headerJSON. It's a means of sending back a primary response
(HTML, XML, text, or whatever) *and* additional data in JSON format as
a header alongside the primary response. So it may be worth checking
if your Rails code is designed to set that header rather than the
Independent Software Consultant
tj / crowder software / com
On Feb 8, 8:05 am, patrick <patrick99...@gmail.com> wrote:
> Ok.. so if I do this:
> it works...... But I just don't understand why it's text in the first
> place.. It seems like something is wrong with the ajax request or
> something.. ?? Is there a better way to do this.. ?
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at