Hello everyone, I'm trying to do this, but without success:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<section id="lista-filmes"></section>
</body>
</html>
JQuery:
var filmes = [];
$.get("https://www.mocky.io/v2/5ad631b32e00001000c93a96", function(data){
data.forEach(function(filme){
filmes.push(filme);
});
});
$.get('http://www.omdbapi.com/?i=tt0108037&apikey=???',function(data){
});
console.log(filmes[0]);
The values I receive are undefined
The idea is, when I proceed to accumulate in a vector the requisition, I move to the second url
for(etc.) {
$.get('http://www.omdbapi.com/?i=${filmes[i]}&apikey=???',function(data)
});
}
Do something like this, so you can consume the second api.