Reputation: 1330
I have this form
<%= 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 %>
and the create
action as well
def create
@post = Post.new(params[:post])
respond_to do |format|
if @post.save
format.js
end
end
end
whatever I write in create.js.erb
it doesn't run, and the browser is redirected to white page!
$('body').html("<h1>Done!</h1>");
Can anyone tell me what's the problem here? Note that I followed the documentation example steps on github
Upvotes: 1
Views: 702
Reputation: 5586
You should make sure
//= require jquery.remotipart
Is added to your application.js file. I was having the same problem and this fixed it.
Upvotes: 1