Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jPages works only after ajax request, not on page load #56

Open
smylmrz opened this issue Dec 6, 2020 · 3 comments
Open

jPages works only after ajax request, not on page load #56

smylmrz opened this issue Dec 6, 2020 · 3 comments

Comments

@smylmrz
Copy link

smylmrz commented Dec 6, 2020

I have this issue. I have a blog page and with posts, and I want to paginate them with jPages, it shows next and previous buttons but not the pages. After filtering the posts it works fine and pages appear on the pagination holder. I've used this plugin before but this is the first time I faced this issue.

@smylmrz
Copy link
Author

smylmrz commented Dec 6, 2020

$(function() {
$(".pagination-holder").jPages({
containerID : "cards",
previous: '{{ trans("button.previous") }}',
next: '{{ trans("button.next") }}'
});
})

@smylmrz
Copy link
Author

smylmrz commented Dec 6, 2020

$('#sort').on('change',function(){

const form = $('.sort-form');

$.ajax({
    url: "{{ route('blog.filter') }}",
    method: 'post',
    data: form.serialize(),
    success:function(r){
        $('#cards').html(r)
    }
})
.done(function(){
  $(".pagination-holder").jPages({
    containerID : "cards",
    previous: '{{ trans("button.previous") }}',
    next: '{{ trans("button.next") }}'
    });
  });
});


$(".sort-form").on('submit', (e) => {
  e.preventDefault()
})

@smylmrz
Copy link
Author

smylmrz commented Dec 6, 2020

The second script works and pages show on the pagination holder after getting a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant