'Cannot save element inside axios
function getMovie(){
let movieId = storage.getItem('movieId');
var title = "";
axios.get("https://api.themoviedb.org/3/movie/" + movieId + "?api_key=...." + "&language=en")
.then(function (e) {
let movie = e.data;
title = movie.title;
console.log(title); //frist
})
console.log(title); //second
}
Only the first one displays on the console, the second one does not. I would like to display both of them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
