I have this code. It makes many ajax requests and store them in the requests array. Then i give $.when() my requests.
value.forEach((data) => { // value contains 5 items
requests.push($.get('my-url/' + data.id ));
});
$.when(requests).then((data) => {
data.forEach((val) => {
console.log(val.responseJSON);
});
});
So, my problem is: If i log the data variable in $.when(), it shows me for my objects the responseJSON prop. But if i try to loop over my objects and access them via val.responseJSON it returns undefined.