I have App, in which, there is a comment input field with image upload.
I designed it to be with ajax. So basically it reloads only partial after posting a comment.
The problem that I’m facing is, it automatically reloads when I try to post a comment with image uploading.
Is this how it’s supposed to be? or my coding problem?
Can anyone tell me why and how I should fix this
view
<%=form_for(([@user, @comment]), :remote => true, :class => 'form' ) do |f| %>
<%= f.text_field :body %>
<button type="submit" class="btn">POST</button>
<%= f.file_field :image %>
<% end %>
You can not send/upload a image via ajax!
You need send a image via html, remove the
:remote => trueRegards!