fetch toolbar results without page reload (#518)

This commit is contained in:
Kevin Papst
2019-01-23 02:45:33 +01:00
committed by GitHub
parent a9ece209ae
commit 89abaa9dda
21 changed files with 344 additions and 117 deletions

View File

@@ -6,11 +6,8 @@
*/
$(document).ready(function () {
//$('.navbar-form select').selectpicker({});
// DateRange - TODO improve me, so users can type without reloading in between
$('.toolbar form input').change(function (event) {
$('.toolbar form').submit();
toolbarLoadDataAfterChange();
});
$('.toolbar form select').change(function (event) {
@@ -27,7 +24,25 @@ $(document).ready(function () {
}
break;
}
$('.toolbar form').submit();
toolbarLoadDataAfterChange();
});
function toolbarLoadDataAfterChange()
{
var $form = $('.toolbar form');
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
success: function(html) {
$('section.content').replaceWith(
$(html).find('section.content')
);
},
error: function(xhr, err) {
$form.submit();
}
});
}
});