I have an AJAX response that will return an array and I push the data onto an array that I created. The array that I created is within the success parameter and I am trying to access that data so it can be used in another ajax call. The global array that it would be pushed to is one of 3 array's that I will be creating and joining to be used at a later time.
currently I have:
$.ajax({
type: "GET",
url: "https://api.twitch.tv/helix/streams?first=20",
headers: {
"Client-ID": "NOTHING TO HERE",
"Accept": "application/vnd.twitchtv.v5+json"
},
success: function(data1) {
var userID = data1.data;
var userIDArr = [];
for (var i = 0; i < userID.length; i++) {
userIDArr.push(data1.data[i].user_id);
}
console.log(userIDArr);
},
dataType: "json"
});
You can see the success parameter has the arr that I would like to utilize outside the AJAX response and in another. Here:
$.ajax({
type: "GET",
url: "https://api.twitch.tv/kraken/users?login=" + userIDArr,
headers: {
"Client-ID": "NOTHING TO HERE",
"Accept": "application/vnd.twitchtv.v5+json"
},
success: function(data) {}
});