I am using the jquery (1.3.2) $ .post command to invoke the ajax call for the rails server.
This code works fine in Safari and Google Chrome (Mac), but when I tried it in Firefox (3.5.7), I got a strange 406 Not Acceptable error.
When I look at the headers, Firefox indicates that it only accepts "text / javascript" responses. And the Content-Type response was 'text / html; encoding = UTF-8'.
In Chrome, the accepted types were 'application / json, text / javascript, /, text / javascript' and the Content-Type response was 'application / json; encoding = 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 really changed in Chrome, but not in Firefox, where it remains "text / html".
Here is the code I used to start the ajax call.
$.post( "/locator", params, function(data){...}, "json" );
Is there something I can do to make this work in Firefox? Thanks
source share