【发布时间】:2012-01-28 01:23:12
【问题描述】:
我有一个使用 AJAX 发送的表单。表格位于FirstsController。我需要将表格发送至SecondsController。发送表单并保存数据。然后我想通过文字改变表格,我尝试这样做:
def create
...saving...
respond_to do |format|
format.js {
render :update do |page|; page << "$('#id_element').html('hellllloooooo');" end
}
format.html {}
end
end
我得到了这个错误:
ActionView::MissingTemplate (Missing template seconds/update, application/update with {:handlers=>[:erb, :builder, :coffee], :formats=>[:js, :html], :locale=>[:en, :en]}.):
我应该如何将JS请求设置回FirstsController? + 需要任何帮助 *.js 文件吗?
【问题讨论】:
-
该错误表示您正在调用更新方法并且没有模板文件。但在您的示例代码中,您使用的是 create 方法。
标签: javascript ajax view ruby-on-rails-3.1 respond-to