title: Multiple ajax requests inside an ajax request using jquery
body: <p>I try to nest Ajax requests and return a whole array of results.</p>
  
  <p>I have a first API call and I need to do do other requests according to the first result. </p>
  
  <p>The order is the following:</p>
  
  <ol>
  <li>First API call </li>
  <li>Loop on results and for each result : do API2 call</li>
  <li>return an array of each element : [{Result1-item, Result2-item})</li>
  </ol>
  
  <p>This is </p>
  
  <pre><code>function getVideos () {
      return $.ajax({
          url: 'URL1'
      })
          .then(function (list) {
              let videos = [];
  
              list.videos.function(video) {
                  return $.ajax({
                      url: video.url_id
                  })
                      .done(function (videoInfo) {
                          videos.push({video: stream, videoInfo: videoInfo})
                      });
              })
          })
          .done(function (allResult) {
              return allResult;
          });
  }
  </code></pre>
  
  <p>The calls are doing great but I don't get how to gather the video + video infos in the same array</p>
  
  <p>What is missing ?</p>