title: Using queue() to load multiple files and assign to globals
body: <p>I cannot get multiple files to load data and assign to globals. I've read up on <a href="https://groups.google.com/forum/#!topic/d3-js/3PpbrzI8yLg" rel="nofollow">similar questions</a> and <a href="https://github.com/mbostock/d3/wiki/Requests" rel="nofollow">related examples</a>, but I still am having trouble.</p>
  
  <pre><code>var origins = [],
      geoJSON = {
        "type": "FeatureCollection",
        "features": []
      };
  
  queue(1)
      .defer(d3.csv, "path_to.csv", function(d) {
          origins.push(d.o_geoid)
        })
      .defer(d3.json, "path_to.json", function(d) {
        // Limit GeoJSON features to those in CSV
        for (var i = d.features.length - 1; i &gt;= 0; i--) {
          if($.inArray(d.features[i].properties['GEOID10'], origins) != -1) {
            geoJSON.features.push(d.features[i]);
          }
        }
      })
      .await(ready);
  
  function ready() {
    console.log(geoJSON);
  }
  </code></pre>
  
  <p>I'm happy to filter the geoJSON features within <code>ready()</code> if that works better, but I need it to happen before I start creating the map with </p>
  
  <pre><code>d3.g.selectAll("path")
      .data(geoJSON.features)
    .enter.append("path")
  ...
  </code></pre>
  
  <p>I'm assuming this has to do with callbacks and empty results, but I can't quite get it working. I have figured out that using <code>.await(console.log(geoJSON));</code> outputs the correct object to the console. The <code>ready()</code> function won't execute though. Thanks for any help understanding and fixing this problem.</p>