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

170
Views
need to properly map data in my success function

I have a success function in my ajax call. The issue I am facing is I need to map the data that gets returned. Outside of this function it maps correctly, but not within. Any help

$.ajax({
  url: "https://example.com",
  type: 'Get',
  headers: {
    accept: "application/json;odata=verbose"
  },
  success: function(data) {
    console.log(data);
    vm.items = data;
    data.Modules.map(function(module) {
      if (module.Topics.length) {
        var url, text
        if (module.Topics[1]) {
          url = module.Topics[1].Url
          text = module.Topics[1].Title
        } else {
          url = module.Topics[0].Url
          text = module.Topics[0].Title
        }
      }
      return {
        url,
        text
      }
    })
  },
})
}
},

about 4 years ago · Juan Pablo Isaza
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!