I'm using Go to write the backend with MongoDB. I am using JQuery AJAX to send requests to the API.
I have an API that accepts parameters (page, limit, offset) and returns all records as a response. I want to perform pagination and send these parameters on page Number button click. I have approx 4,50,000 records in the collection.
I have searched some examples using pagination plugin but from what I understood it will first load all records from DB then perform pagination but I do not want to load all records because I am already sending (page, limit, offset parameters to limit records. How we can do that using HTML and JQuery?
<a href='#' onclick='getRecords(page,limit,offset)'>1</a>
I am using using Find().skip().limit().All(&result) in golang. And My HTML code is like first table show first 10 rows from db and then
<a herf='' onclick='getRecords(1,10,0)'>1</a>
<a herf='' onclick='getRecords(2,10,10)'>2</a>
<a herf='' onclick='getRecords(3,10,20)'>3</a>
...
function getRecords(page,limit,offset)
{
$.ajax(){}
}
I want to do it dynamic with next and prev like pagination