Skip to content

Instantly share code, notes, and snippets.

@techbrownbags
Created April 4, 2019 16:51
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 techbrownbags/bfc88ce89aa29f1a5c6b75e4da8199c8 to your computer and use it in GitHub Desktop.
Save techbrownbags/bfc88ce89aa29f1a5c6b75e4da8199c8 to your computer and use it in GitHub Desktop.
<script>
$(document).ready(function() {
$('input#system_search_form_btn').on('click', function(e) {
// submits related form
});
$('form#system_search_form').on('submit', function(e) {
e.preventDefault();
$.ajax({
type: $(this).attr('method'),
url: $(this).attr('action'),
data: $(this).serialize(),
beforeSend: function( xhr ) {
$('#loading').addClass('loading');
}
}).done(function(response) {
$( '#systems_search_table' ).html( response );
}).fail(function(response) {
}).always(function() {
$('#loading').removeClass('loading');
});
});
$('input#system_search_form_btn').click();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment