jquery $.ajax not working in firefox against rails (406 response) (works in chrome & IE)
- by phil swenson
I have a rails backend and am testing the following jquery code against it:
var content = $("#notification_content").val();
var data = new Object();
data.content = content;
$.ajax({ url: "/notifications/detect_type.json", type:"POST", data: data, success: function(result ){updateTypeDropDown(result)}});
This code works fine in Chrome and IE. However in Firefox (using Firebug), I see this:
http://localhost:3000/notifications/detect_type.json 406 Not Acceptable
here is a chrome request in the log:
Processing
NotificationsController#detect_type
(for 127.0.0.1 at 2010-12-21 17:05:59)
[POST] Parameters:
{"action"="detect_type",
"content"="226 south emerson denver
co 80209",
"controller"="notifications"} User
Columns (2.0ms) SHOW FIELDS FROM
users User Load (37.4ms) SELECT
* FROM users WHERE (users.id = '1') LIMIT 1 Completed in 58ms (View:
1, DB: 40) |
406 Not Acceptable [http://localhost/notifications/detect_type.json]
here is a firefox request in the log:
Processing
NotificationsController#detect_type
(for 127.0.0.1 at 2010-12-21 17:06:41)
[POST] Parameters: {"action"="detect_type",
"content"="226 south emerson 80209",
"controller"="notifications"}
User Columns (2.1ms) SHOW FIELDS FROM users
User Load (30.4ms)
SELECT * FROM users WHERE (users.id = '1') LIMIT 1 Completed
in 100ms (View: 1, DB: 33) |
200 OK [http://localhost/notifications/detect_type.json]
I'm stumped. Ideas?