【发布时间】:2011-06-12 21:05:20
【问题描述】:
我的 _new.html.erb 中有以下函数。当 element_id_placeholder 改变时,我想调用一个控制器:
<script type="text/javascript">
// When DOM loads, init the page.
$(function() {
// Executes a callback detecting changes with a frequency of 1 second
$("#id_element_placeholder").observe_field(1, function( ) {
alert('Change observed! new value: ' + this.value );
// call controller
});
});
</script>
我正在使用 Rails 3
【问题讨论】:
标签: javascript ruby-on-rails ajax ruby-on-rails-3