I'm having a little bit trouble crating a list pagination. I know that I can use next__ but I'm new to js and rest so I can't find a way.

$(document).ready(function () {
Printitem() ;

var allItems = ko.observableArray([]);

function GetItemFromList() {
urlRest = "RESTURL/items?$orderby=Created desc&$top=2";

var self = this;
    url: urlRest,
    type: "GET",
    async: false,
    headers: {
        "accept": "application/json;odata=verbose",
    success: function (data) {      
        var item = data.d;
        var next = data.d.__next ;
        console.log("next "+next);

        for (var i = 0; i < item.results.length ; i++) {

            var ID = item.results[i].ID; //Get item ID
            var type = item.results[i].type; //

            var firstNameUnit = item.results[i].Unit1;
            var secondNameUnit = item.results[i].Unit2;

            var Details = { 
            showtfirstName : firstNameUnit,
            showsecondName : secondNameUnit,

    error: function (error) {


function Printitem() {
var tr = document.getElementById('allItemsTable')
ko.applyBindings(self, tr);

My HTML is simple, a table with all the data and I'm using KO to bind the data. I would like to have two buttons NEXT and PREVIOUS. I've tried this TUTORIAL but I wrote my code before reading this (I have more calculations and items in the object but I deleted them because it's not relevant for the question).

thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.