我有这个表格
<%= form_for @post, :html => {:multipart => true , :class => 'form-horizontal' }, :remote => true do |f| %>
<%= f.text_field :title%>
<%= f.file_field :avatar%>
<%= f.submit nil%>
<% end %>
以及create
操作
def create
@post = Post.new(params[:post])
respond_to do |format|
if @post.save
format.js
end
end
end
无论我在create.js.erb
中写什么,它都没有运行,浏览器被重定向到白页!
$('body').html("<h1>Done!</h1>");
谁能告诉我这里的问题是什么? 请注意,我按照github
上的文档示例步骤操作