Im trying to load person data from api : www.swapi.co . However i dont know how can i load movies titles instead of their api adress.
$(function(){
var list = $('.list');
var submit = $('.submit-people');
var people = '1';
submit.on('click',function(){
people++;
list.empty();
$.ajax({
type: 'GET',
url: 'https://swapi.co/api/people/' + people + '/',
success: function(data) {
list.append('<li>Name:' + data.name + '</li>');
list.append('<li>Height:' + data.height + '</li>');
list.append('<li>Mass:' + data.mass + '</li>');
list.append('<li>Gender:' + data.gender + '</li>');
list.append('<li>Movies:' + data.films + '</li>');
}
})
})
my current code is here : https://jsfiddle.net/wtpy71d7/2/
really thanks for any help or suggestions
data.films, you have to do another query (another$.ajax) to fetch the details (e.g., movie title). This is a common feature of REST APIs.