Prototype and application/json


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!