title: Google Charts, AJAX, PHP Problem Encoding JSON Error: Data for arrayToDataTable is not an array
body: <p>I am trying to do some basic Google Charts filled by databse via PHP/PDO/MSSQL passed via AJAX to the .js</p>
  <p>I'm having a very basic problem that i feel is encoding.</p>
  <p>I am following the tutorial <a href="https://developers-dot-devsite-v2-prod.appspot.com/chart/interactive/docs/gallery/linechart" rel="nofollow noreferrer">https://developers-dot-devsite-v2-prod.appspot.com/chart/interactive/docs/gallery/linechart</a></p>
  <p>They hardcode the data into the google chart but i send mine over via Ajax.  My data from the Ajax looks like this:</p>
  <pre><code>$data = &quot;['Year', 'Sales', 'Expenses'],['2004',  1000,      400],['2005',  1170,      460], ['2006',  660,       1120],['2007',  1030,      540]&quot;;
         
  echo (json_encode($data));
  
  resulting in:
  &quot;['Year', 'Sales', 'Expenses'],['2004', 1000, 400],['2005', 1170, 460], ['2006', 660, 1120],['2007', 1030, 540]&quot;
  </code></pre>
  <p>However when I run the chart i get the error &quot;Error: Data for arrayToDataTable is not an array.&quot;</p>
  <p>I'm sending the exact same data verbatim but via AJAX so what am I missing?</p>
  <p>Instead of the google sample:</p>
  <pre><code> function drawChart() {
          var data = google.visualization.arrayToDataTable([
            ['Year', 'Sales', 'Expenses'],
            ['2004',  1000,      400],
            ['2005',  1170,      460],
            ['2006',  660,       1120],
            ['2007',  1030,      540]
          ]);
  
          var options = {
            title: 'Company Performance',
            curveType: 'function',
            legend: { position: 'bottom' }
          };
  
          var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
  
  </code></pre>
  <p>I'm using:</p>
  <pre><code>function drawChart() {
  
            var jsonData = $.ajax({
              url: &quot;reports/GoogleCharts/ajax_StationExpenses.php&quot;,
              dataType: &quot;json&quot;
            }).responseText;
   
  
         var data = new google.visualization.arrayToDataTable(jsonData);
          
         var options = {
            title: 'Station Utility Expense Over $250 by Month',
            curveType: 'function',
            legend: { position: 'bottom' },
            width: 800,
            height: 600,
            animation:{ startup: true, duration: 1700, easing: 'in' }
          };
  
          var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
          chart.draw(data, options);
  }
  
  </code></pre>
  <p>What am I missing, why does it take it hardcoded but not in what appears to be the exact same format pushed by AJAX from my php page?</p>