i am using Remotipart to upload files. The Rails-Controller handles the file but i cant figure out how to get the following ajax response. Here is my js code.
$file.children(".description").html(
'<%= form_for FileObject.new, :url => file_object_index_path , :html => { :multipart => true }, :remote => true do |f| %>' +
'<div class="field">' +
'<%= f.label :file %>' +
'<%= f.file_field :file %>'+
'</div>' +
'<input type="hidden" name="directory_object_id" value="' + current_directory.id +'" />' +
'<div class="actions">' +
'<%= f.submit %>' +
'</div>' +
'<% end %>'
);
$("form").bind('ajax:success', function(){
alert("success");
});
Maybe someone has solved this before.
Instead of binding to
ajax:success
, try this:I have had trouble binding ajax support when using remotipart, and have used the above workaround in the past.