Merge pull request #1766 from dalf/fix-infinite-scroll

[mod] infinite scroll: XHR requests are sent with the header "Accept: text/html"
This commit is contained in:
Markus Heiser 2020-01-28 11:04:02 +00:00 committed by GitHub
commit 54675c7690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -5,12 +5,18 @@ $(document).ready(function() {
var formData = $('#pagination form:last').serialize(); var formData = $('#pagination form:last').serialize();
if (formData) { if (formData) {
$('#pagination').html('<div class="loading-spinner"></div>'); $('#pagination').html('<div class="loading-spinner"></div>');
$.post('./', formData, function (data) { $.ajax({
var body = $(data); type: "POST",
$('#pagination').remove(); url: './',
$('#main_results').append('<hr/>'); data: formData,
$('#main_results').append(body.find('.result')); dataType: 'html',
$('#main_results').append(body.find('#pagination')); success: function(data) {
var body = $(data);
$('#pagination').remove();
$('#main_results').append('<hr/>');
$('#main_results').append(body.find('.result'));
$('#main_results').append(body.find('#pagination'));
}
}); });
} }
} }