Try using AJAX to fetch just the data, not the javascript that builds a 
chart.  You can have a generic function that draws a chart based on the 
data fetched from AJAX; as a basic example:

function drawChart (params) {
    $.ajax({
        data: params,
        dataType: 'json',
        success: function (json) {
            var data = new google.visualization.DataTable(json.dataTable);
            if (json.chartType == 'barChart') {
                var chart = new google.visualization.BarChart($('#'+json.
divId)[0]);
            }
            else if (json.chartType == 'columnChart') {
                var chart = new google.visualization.ColumnChart($('#'+json.
divId)[0]);
            }
            chart.draw(data, json.options);
        }
    });
}

This avoids the problem of trying to execute fetched js code.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/Ik4JkoXWhF4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to