ruby on rails - Remotipart getting ajax response -


i using remotipart upload files. rails-controller handles file cant figure out how following ajax response. here js code.

$file.children(".description").html(     '<%= form_for fileobject.new, :url => file_object_index_path , :html => { :multipart => true }, :remote => true |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 has solved before.

instead of binding ajax:success, try this:

$("form").bind("ajax:complete", function(e, data, status, error){     if (data.status === 200 || data.status === 201) {         ...     } }) 

i have had trouble binding ajax support when using remotipart, , have used above workaround in past.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -