1

I am having a problem in getting the html input value in the ruby periodically_call_remote...

For example:

i have an input named my_input. Now i want to have this in the periodically_call_remote.

<input name="my_input" />

periodically_call_remote(:url=>{:action=>"action_name", :controller=>"controler_name", nvalue=>"value_of_my_input"}, frequency=>"5")

This is the call in which i want to have the input value in the value_of_my_input.

rails gem version: 2.3.5

how will i achieve this..?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Jamal Abdul Nasir
  • 2,557
  • 5
  • 28
  • 47

3 Answers3

1

I know that you are using rails 2.3.5 but "periodically_call_remote" is deprecated in Rails 3, so I recommend that you use something like this instead:

$(document).ready(function(){
setInterval(function(){
  $.get('<%= url_for :action=>"action_name", :controller=>"controler_name", :value=>"value_of_my_input" %>', function(value) {
    $('#my_input').val(value);
});
},5000);

});

arocha
  • 29
  • 3
0

You need response by your action action_name a javascript script doing the update of you input.

$('#id_of_my_input').val('<%= @my_new_value %>')
shingara
  • 46,608
  • 11
  • 99
  • 105
0

i have achieved what i wanted... the code is as:

periodically_call_remote(:url=>{:controller=>"controller_name", :action=>"action_name"), :with=>"'name='+jQuery('#id').val()")

Thnx for your help and time brothers...

Jamal Abdul Nasir
  • 2,557
  • 5
  • 28
  • 47