I have an CSV parsing function in JavaScript which gets data (movie names) from CSV and gets data using Ajax call in loop.
movies = new Array();
for (var i = 1; i < allData.length; i++) {
    var mName = allData[i][0];
    var mPath = allData[i][1];
    // console.log(decodeURIComponent(mName));
    $.get(apiCall, function showData(data) {
        if (data) {
            mData = data.results;
            if (mData.length > 1) {
                var urlData = new URLSearchParams(this.url);
                var movie_name = urlData.get('query');
                movies.push(movie_name);
            }
        }
    })
}
If data got more then one record for any movie it will save it as a conflict in array.
Problem is, I can access movies array inside inner if (but it is in iteration so I can't use that) and at loop end it is not accessible. How can I access that?
 
     
     
     
     
    