Skip to content

Instantly share code, notes, and snippets.

@Frank004
Created February 17, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Frank004/f5bfa82ee39aa010c637e948bef9b67a to your computer and use it in GitHub Desktop.
Save Frank004/f5bfa82ee39aa010c637e948bef9b67a to your computer and use it in GitHub Desktop.
#--------ba_partial-------
<%= bootstrap_form_for ba, remote: true, data_id: ba.id do |f| %>
...
<div id="loader" class='load-ajax hide'></div>
<% end %>
$(document).ajaxStart(function() {
$("#loader").show();
}).ajaxStop(function() {
$("#loader").hide('slow');
});
#-------index-------
<% @baz.order("id DESC").each do |ba| %>
<%= render partial: 'ba_partial', locals: {ba: ba} %>
<% end %>
$(document).on('submit', ".edit_ba", function( e ) {
e.preventDefault();
$.ajax( {
url: $(this).attr('action'),
type: 'POST',
data: new FormData( this ),
processData: false,
contentType: false
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment