Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Ajax multiple ajax request from online file
function addIDS() {
  const imdbIDs = [];
  imdbIDs.push("id1");
  imdbIDs.push("id2");
  ...
  return imdbIDs ;
}

function getThemoviedbIDs(IDs) {
  let arr = [];
  let urls = [];
  for(let i = 0; i < IDs.length; i++) {
    urls.push(`...${imdb_ids[i]}...`);
  }
  $.each(urls, (i, u) => {
    $(function() {
      $.ajax({
        url: u,
        dataType: 'json',
        success: function(data) {
          arr.push(data.tv_results[0].id);
        },
        statusCode: {
          404: function() {
            alert('Err');
          }
        }
      });
    });
  });
  return arr;
}

function getDetails(themoviedbID) {
  console.log(themoviedbID);
  console.log(`...${themoviedbID[0]}`);
}


const imdbIDs = addIDS();
console.log("IMDB IDs: ", imdbIDs);

const themoviedbIDs = getThemoviedbIDs(imdbIDs);
console.log("themoviedbIDs: ", themoviedbIDs);

const themoviedbIDs = getThemoviedbIDs(themoviedbIDs);
console.log("themoviedbIDs: ", themoviedbIDs);

I am using themoviedb database.

populate() I add imdb IDs to the imdbIDs array, then I get themoviedb IDs by getThemoviedbIDs() function.

In the getDetails() function I would like to make ajax request just like in the getThemoviedbIDs() function, but unfortunatelly there is a problem in there. console.log(themoviedbID) output the appropriate array, but console.log(...${themoviedbID[0]}) output .../undefined...

I can get enough information about the series if I am using themoviedb ID.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!