I have a following function in my _new.html.erb. I would like to call a controller when the element_id_placeholder is changed:
<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>
I'm using rails 3