ATTENTION: This code is just an initial approach of the program. For further updates, plz visit #22
The function has to retrieve the values from the API when the user enters a name inside the <input> HTML tag. When the function is executed, the program will show all the data available or related to the name.
@CONSOLE
let api_key = '94f0c60308f2a42f4c8a0265000556cd';
let submit_button = document.getElementById( 'submit');
function api_tmdb() {
submit_button.addEventListener('click',function(event) {
event.preventDefault();
let input_actor = document.getElementById('name').value;
let request_movie = 'https://api.themoviedb.org/3/search/person?api_key=' + api_key + '&language=en-US&query=' + input_actor + '&page=1&include_adult=false';
console.log('Results related to: ' + input_actor);
fetch(request_movie).then(function (response) {
return response.json();
})
.then(function (data) {
let obj_id = data.results;
console.log(obj_id);
});
});
}
api_tmdb();
You may find useful to look for the previous version to understand how I got to this solution: #11
Plz, let me know what do you think.
cc @ltrevino @ian-dot @DlgzRogelio
Retrieve Data
ATTENTION: This code is just an initial approach of the program. For further updates, plz visit #22
The function has to retrieve the values from the API when the user enters a name inside the
<input>
HTML tag. When the function is executed, the program will show all the data available or related to the name.@CONSOLE
You may find useful to look for the previous version to understand how I got to this solution: #11
Plz, let me know what do you think. cc @ltrevino @ian-dot @DlgzRogelio