Forum: Ruby on Rails Prototype and application/json

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
monkeyten (Guest)
on 2009-02-19 18:03
(Received via mailing list)
I have a feeling I am doing something wrong here (the great thing with
Rails is that when it gets difficult you can generally assume that to
be the case!), so any comments are appreciated.

I have a link on a page that makes an XHR. I'd like to return a JSON
object to the page which can then be eval'd and various bits of data
used. I set up the routing to make sure the format came through as
JSON (http://xxx/xxx/xx.json) using :format, and the controller
returns the JSON object. The problem is that that response is sent as
'application/json', which is not a default accept header (so I end up
with a 406 response).

Obviously I could adjust the response header to include that MIME
type, but my guess is that I am doing something stupid here and have
missed something - any ideas appreciated!
This topic is locked and can not be replied to.