I’m trying to get all the games from the twitch API and be able to search through them so far I have done this:
var games = [];
$.ajax({
url: 'https://api.twitch.tv/helix/games/top',
headers: {
'Client-ID':'xxxxxxxxxxxxxxxxxxxxxx',
'Content-Type':'application/json'
},
method: 'GET',
dataType: 'json',
success: function(data){
games.push(data.data)
}
});
$(document).ajaxComplete(function() {
var search = "Counter-Strike".toLowerCase();
var results = games[0].filter(function(data) {
return data.name.toLowerCase().indexOf(search) > -1;
});
console.log(results);
});
Now how do I use pagination to get the rest of the games and save them in the game’s array? by the way, is it allowed to get so much data?