【发布时间】:2010-12-22 00:26:39
【问题描述】:
我有一个 Rails 后端,正在测试下面的 jquery 代码:
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)}});
此代码在 Chrome 和 IE 中运行良好。但是在 Firefox(使用 Firebug)中,我看到了这个: http://localhost:3000/notifications/detect_type.json 406 不可接受
这是日志中的一个 Firefox 请求:
处理 NotificationsController#detect_type (127.0.0.1 2010-12-21 17:05:59) [POST] 参数: {"action"=>"detect_type", “内容”=>“226 南艾默生丹佛 公司 80209", “控制器”=>“通知”} 用户 列 (2.0ms) 显示字段来自
users用户负载 (37.4ms) 选择 * FROMusersWHERE (users.id= '1') LIMIT 1 在 58 毫秒内完成(查看: 1, DB: 40) | 406 不可接受 [http://localhost/notifications/detect_type.json]
这是日志中的 chrome 请求:
处理 NotificationsController#detect_type (127.0.0.1 2010-12-21 17:06:41) [POST] 参数:{"action"=>"detect_type", “内容”=>“226 南艾默生 80209”, “控制器”=>“通知”}
用户列(2.1ms)显示来自users的字段
用户负载 (30.4ms)
SELECT * FROMusersWHERE (users.id= '1') LIMIT 1 完成 在 100 毫秒内(查看:1,DB:33)|
200 OK [http://localhost/notifications/detect_type.json]
我被难住了。想法?
【问题讨论】:
-
对于任何可能遇到此问题的人,我在 firefox 中遇到了完全相同的错误,然后我意识到我在 firefox 中禁用了 javascript。
标签: jquery ruby-on-rails