我在将 ajax 发布到 ROR 操作(从一台服务器到另一台服务器)时遇到了一些问题。基本上,这个请求:
post_json = { "stuff": [{"1" => "foo"}] };
$.ajax({
url: "http://someurl.com/api/random_post_action",
type: "post",
dataType: "json",
data: post_json,
success: function(data){
console.log(data);
}});
给出 random_post_action 参数(ruby on rails):
{
"stuff" => {
"0" => {
"1" => "foo"
}
},
"controller" => "api",
"action" => "random_post_action"
}
预期:
{
"stuff" => [
[0] {
"1" => "foo"
}
],
"controller" => "api",
"action" => "random_post_action"
}
我不确定发生了什么...