I am also getting this error.  Here is my code:
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
    <script type="text/javascript" 
src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript">
    
    // Load the Visualization API and the piechart package.
    google.charts.load('current', {'packages':['corechart']});
      
    // Set a callback to run when the Google Visualization API is loaded.
    google.charts.setOnLoadCallback(drawChart);
      
    function drawChart() {
      var jsonData = 

$.ajax({
  url: "../index.cfm?fuseaction=Dashboards.Data&returnformat=json",
  dataType: "json",
}).done(function (jsonData) {
  var data = new google.visualization.DataTable();
  data.addColumn('string', 'Week');
  data.addColumn('number', 'Retail');
  data.addColumn('number', 'Wholesale');

  jsonData.forEach(function (row) {
    data.addRow([
      row.Week,
      row.Retail,
      row.Wholesale
    ]);
  });

  var chart = new 
google.visualization.LineChart(document.getElementById('chartDiv'));
  chart.draw(data, {
    width: 400,
    height: 240
  });
}).fail(function (jq, text, err) {
  console.log(text + ' - ' + err);

    </script>
  </head>

Data file looks like this:
{ "sEcho": 0, "iTotalRecords": 753, "iTotalDisplayRecords": 753, 
"iTotalRecords": 753, "aaData": 
[["0","1010360"],["0","2010523"],["0","2010894"],["0","2091560"]] }

Thank you!
On Tuesday, July 3, 2012 at 9:14:04 AM UTC-4, fsalam wrote:
>
> Hi, 
>
> I am using your sample code for php, except that my php is a remote 
> server and not local. Here is the html code 
>
>
> <html> 
>   <head> 
>     <!--Load the AJAX API--> 
>     <script type="text/javascript" src="https://www.google.com/ 
> jsapi"></script> 
>     <script type="text/javascript" src="http://ajax.googleapis.com/ 
> ajax/libs/jquery/1/jquery.min.js 
> <http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js>"></script> 
>     <script type="text/javascript"> 
>
>     // Load the Visualization API and the piechart package. 
>     google.load('visualization', '1', {'packages':['corechart']}); 
>
>     // Set a callback to run when the Google Visualization API is 
> loaded. 
>     google.setOnLoadCallback(drawChart); 
>
>     function drawChart() { 
>       var jsonData = $.ajax({ 
>           url: "http://192.168.10.51:82/gchartsapi/ 
> getReportsData.php <http://192.168.10.51:82/gchartsapi/getReportsData.php>", 
>
>           dataType:"json", 
>           async: false 
>           }).responseText; 
>
>       // Create our data table out of JSON data loaded from server. 
>       var data = new google.visualization.DataTable(jsonData); 
>
>       // Instantiate and draw our chart, passing in some options. 
>       var chart = new 
> google.visualization.PieChart(document.getElementById('chart_div')); 
>       chart.draw(data, {width: 400, height: 240}); 
>     } 
>
>     </script> 
>   </head> 
>
>   <body> 
>     <!--Div that will hold the pie chart--> 
>     <div id="chart_div"></div> 
>   </body> 
> </html> 
>
> I am setting output as application/json in the php file. 
>
> When I invoke the php url directly, I am getting the following json 
> file. 
> { 
>   "cols": [ 
>         {"id":"","label":"Topping","pattern":"","type":"string"}, 
>         {"id":"","label":"Slices","pattern":"","type":"number"} 
>       ], 
>   "rows": [ 
>         {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]}, 
>         {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]}, 
>         {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]}, 
>         {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]}, 
>         {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]} 
>       ] 
> } 
>
> However, when called from the above javascript, it comes with a 'Table 
> has no columns' message. I am new to json. Am I doing something wrong? 
> Why is the javascript not able to get the json data? Please help. 
>
> -fsalam 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/1f3e0e91-caa0-430d-ac65-06a41f5e5ba0%40googlegroups.com.

Reply via email to