I am simply using -
respond_to do |format|
format.js
end
in my create action. Don't know why but i am getting an the UnknownFormat error. The error is gone if i put in both "format.html" and "format.js". But i want to stay in the same page and make an ajax call. I have gone through like 5 pages of google search results for every possible search and still nothing works for me. Can anyone help me out here?
My form is like this -
<%= form_for [:home, Photo.new], remote: true, :html => {:id => "new-photo-form"} do |f| %>
<div id="upload-field">
<%= f.file_field :image %>
</div>
<%= f.hidden_field :album_id, :value => album.id %>
<div id="photo-add-link">
<%= link_to 'Add Selected Images', '#', remote: true, :onclick => "$('#new-photo-form').submit()" %>
</div>
<% end %>
Aucun commentaire:
Enregistrer un commentaire