2
저는 _new.html.erb에 다음과 같은 함수가 있습니다. element_id_placeholder이 변경 될 때 나는 컨트롤러를 호출 할 수 싶습니다rails3의 javascript에서 컨트롤러/액션을 실행하십시오.
<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>
을 나는
이
감사하지만 작동 내 컨트롤러 /보기로 이동합니다. 어떻게 그 메소드의 일부로 만들 수있는 모델 객체 또는 심지어 json 객체를 돌려주는 메소드를 호출 할 수 있을까요? – user140736
respond_to, 형식 : js 및 렌더링 사용 : json – apneadiving