I am retrieving data from a Json object with 55 entries, but I would like to limit it to 10 items. What is the best practice for this?
Also what if I later want to click on a button and load more data (let says either 10 or 25 more items)?
My code:
$.ajax({
url: 'data.json',
type: 'GET',
dataType: 'json',
success: function(response) {
console.log('success!');
var fixtureHTML = '';
$.each(response.data, function(key, value) {
// do something with data retrieved from JSON
});
// Append generated HTML to DOM
$('.js-load').append(fixtureHTML);
}, // End of Success
error: function() {
console.log('errror');
}
});