This thread will be useful: https://groups.google.com/forum/#!msg/d3-js/3Y9VHkOOdCM/YnmOPopWUxQJ
The best solution (IMO) from the link is this:
var rows1, rows2, remaining = 2;
d3.csv("file1.csv", function(csv) {
rows1 = csv;
if (!--remaining) doSomething();
});
d3.csv("file2.csv", function(csv) {
rows2 = csv;
if (!--remaining) doSomething();
});
function doSomething() {
// … do something with rows1 and rows2 here …
}