Ruby on rails 在rails上的ajx中传递文本_字段值

Ruby on rails 在rails上的ajx中传递文本_字段值,ruby-on-rails,ajax,Ruby On Rails,Ajax,我正在使用 <%= text_field 'person', 'one',:id => 'test', :onchange=>remote_function(:url=>{:action=>"update"}, :update=>"test") %> <div id="test"></div> 'test',:onchange=>远程函数(:url=>{:action=>“update”},:update=>“test”)%>

我正在使用

<%= text_field 'person', 'one',:id => 'test', :onchange=>remote_function(:url=>{:action=>"update"}, :update=>"test") %>
<div id="test"></div>
'test',:onchange=>远程函数(:url=>{:action=>“update”},:update=>“test”)%>
现在我只想用:action发送text_字段的值 i、 e
:url=>{:action=>“更新(输入的文本字段的值)}

不想使用params[:person][:one]

有什么建议吗?或者我如何使用发送带有操作的值?

使用

<%= text_field 'person', 'one',:id => 'test' %>

<%= observe_field 'persone_one', 
     :url=>{:action=>"update"} ,
 :frequency => 0.25,
     :update=>'test',
     :with => 'person_one'
     %>

<div id="test"></div>
”测试“%”
{:action=>“update”},
:频率=>0.25,
:update=>“测试”,
:with=>“person\u one”
%>

您可以在参数[:person\u one]中获得textfield的值。也许您可以使用javascript代码“this.value()”

您也可以尝试使用此代码:



### Paste following code in your javascript

$("#person_one").live("change", function(){
  $.ajax({
    complete:function(request){},
    data:'person_one='+ $(this).val(),
    dataType:'script',
    type:'get',
    url: '/update'route
  })
});


请检查我的答案,如果不起作用,请告诉我。