I'm using Jquery (1.3.2) $.post command to trigger an ajax call to a rails server.
The code works great on Safari and on Google Chrome (mac), but when I tried it on Firefox (3.5.7), I got a weird '406 Not Acceptable' error.
When I look at the headers, it Firefox indicated that it accepted only ' text/javascript' responses. And the response Content-Type was 'text/html; charset=utf-8'.
In Chrome the accepted types were 'application/json, text/javascript, /, text/javascript' and the response Content-Type was 'application/json; charset=utf-8'.
I tried to force the content type in rails to 'text/javascript'
format.json do
render :json => @races.to_json, :content_type => 'text/javascript'
end
The content type is indeed changed in Chrome, but not in Firefox where it remains 'text/html'.
Here is the code I used to trigger the ajax call.
$.post(
"/locator",
params,
function(data){...},
"json"
);
Is there something I can do to make this work in Firefox? Thanks