title: loop 100+ getJSON calls and call a another function when completely done
body: <p>I need to read a grid and take that data and call a $getJSON url.  The grid could have over 100 lines of data. The getJSON returns a list of comma separated values that I add to an array.  Once the loop is finished I take the array and process it for the duplicates.  I need to use the duplicates in another process.  I know that I can't determine the order of the data that is coming back but I need to know that all of the calls have been make. </p>
  
  <pre><code>            for (let i = 0; i &lt; rowscount; i++){
                $.getJSON(
        "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&amp;retmode=json&amp;retmax=500&amp;term=" +
        terms,
        function (data) {
          var pmids = data.esearchresult.idlist;
          var pmidlist = pmids.join();
          pmid_List.push(pmidlist);
          if (i == rowscount - 1) {
            // call the related function
          }            
        });
         }
  </code></pre>
  
  <p>I can't figure out how to be sure that the process has finished.  The call to the related function has been done early at times.</p>