I have a form partial, within a div with id "chapcomments", with a submit tag -
<%= f.submit "Post", remote: true %>
In the correct view folder, I have create.js.erb -
$('#chapcomments').html("<%=j render 'shared/chap_comment_complete' %>");
And in the controller I have the format block which includes
def create
@chap_comment = current_user.chap_comments.build(chap_comment_params)
respond_to do |format|
if @chap_comment.save
format.js
format.html {redirect_to chapter_path(@chap_comment.chapter)}
else
format.html { render :new }
format.json { render json: @chap_comment.errors, status: :unprocessable_entity }
end
end
end
...but I'm not getting ajax behaviour...
Where am I going wrong?