开发者

remote_function and select boxes in Rails

开发者 https://www.devze.com 2022-12-26 10:06 出处:网络
I have a select box that needs to submit it\'s value to a server side controller on change. The submit works. The value of the changed element is h开发者_如何学Pythonowever not sent.

I have a select box that needs to submit it's value to a server side controller on change.

The submit works. The value of the changed element is h开发者_如何学Pythonowever not sent.

I've scoured some examples online, but none seem to work

 remote_function(
     :url => some_remote_function_path,
     :with => "'key1='+$('elem_id').value +'&key2='+$('elem_id').value+ '&this_elem_value='+value"
  )

The moment I pass

$('elem_id').value

I simply get that 'statically' as the actual variable passed.

How do I get access to the selected select box value? I'm sure I'm missing something minute her.

Thanks.


You should use jQuery.val() not .value.

0

精彩评论

暂无评论...
验证码 换一张
取 消