jquery - How to load json array -


im trying load person data api : www.swapi.co . dont know how can load movies titles instead of 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 here : https://jsfiddle.net/wtpy71d7/2/

really or suggestions

this might you.

success: function(data) {      ...      for(var = 0; i< data.films.length; i++ )           $.ajax({              type: "get",              url: data.films[i],               success: function (data) {                 list.append('<li>movies:' + data.title + '</li>');              }           });      } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -