title: Saving data from the d3.js ajaxrequest in a variable to create axis with data
body: <p>I read a lot of posts here about how to save my data in a variable. To do so I created the global variable "arraydates". It needs to be in an array to be used for the axis tick values which is working fine. But only the first console.log within the ajax-request is working. The second one doesn´t give anything. Any clues why? Is it because the Ajaxrequest is asynchronous?
  And what would be a better solution then?
  Thanks for suggestions.</p>
  
  <p>var arraydates;</p>
  
  <pre><code>        d3.json("/weather/date.json", function(error, datad) {
  
          var array = [];
          for(var i in datad)
              array.push( datad[i].date);
              arraydates=array;            
  
          console.log(arraydates);
  
          });
  </code></pre>
  
  <p>console.log(arraydates);</p>