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

236
Views
How do I fix the 'drivers is undefined' error?

This function is currently set to grab both feeds and store the results in a global variable, then it calls the compare function and loops through the weekend feed to create an array of objects. Currently, I keep getting an error saying 'drivers is undefined' and was wondering if anyone can help me fix it?

            var weekendFeed = {};
            var driversFeed = {};
            jQuery(document).ready(function() {
                jQuery.getJSON("https://cf.nascar.com/cacher/2021/1/5044/weekend-feed.json")
                    .done(function(res){
                        weekendFeed = res;
                        jQuery.getJSON("https://www.nascar.com/json/drivers/")
                            .done(function(res){
                                driversFeed = res;
                                compareFeeds();
                            });
                    });
                function compareFeeds(){
                    //console.log(weekendFeed.weekend_race[0].results);
                    //console.log(driversFeed);
                    var weekendDrivers = [];
                    for(driver in weekendFeed.weekend_race[0].results){
                        drivers.push({"id" : weekendFeed.weekend_race[0].results[driver].driver_id});
                        drivers.push({"name" : weekendFeed.weekend_race[0].results[driver].driver_fullname});
                        drivers.push({"make" : weekendFeed.weekend_race[0].results[driver].car_make});
                    }
                    console.log(weekendDrivers);
                }
            });
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!