您好,我有一个使用 jQuery UJS for rails 远程提交的表单。我绑定到 beforeSend 事件以允许我修改提交到服务的数据。它不工作。这是我在 beforeSend 中的内容:
settings.data = JSON.stringify({
'list_item[title]' : 'hi?? there'
})
这行不通。在服务器日志中,我看到了这个:
Started POST "/lists/9/list_items" for 127.0.0.1 at 2011-10-24 14:04:36 -0700
Processing by ListItemsController#create as JSON
Parameters: {"{\"list_item"=>{"title"=>{"\":\"hi?? there\"}"=>nil}}, "list_id"=>"9"}
知道我做错了什么吗?我想使用不在表单中的添加字段来自定义 settings.data。谢谢