Fusioncharts中没有数据显示错误

我用ajax绘制图表。我有两个文件index.php,selectchart.php。在index.php中,我用ajax绘制图表。

$.ajax({
                type : "POST",
                url  : "selectchart.php?country="+selectedcountry,
                data : selectedcountry,
                success: function(result)
                   {
                   $("#chart-1").hide();
                   $("#myDiv").show();
                   alert(result);

                    var myChart = new FusionCharts("column2D", "myChartId" , 400, 300, "json", "result");

                  myChart.render("chart-mon");

                    }
                  });

I have alert the result [objectoject] showed.But in chart-mon no data is diplayed showed.but I run the selectchart.php

{"chart":{"showValues":"0","theme":"zune"},"data":[{"label":"washing","value":"1000"},{"label":"cleanin","value":"444"},{"label":"rwr","value":"333"},{"label":"sample","value":"300"},{"label":"werew","value":"33"},{"label":"demo","value":"10"}]} these values are displayed.[enter image description here][1]
评论
  • 未命名
    未命名 回复

    解决方案1:

    我认为您没有通过:

    代替它

    var myChart = new FusionCharts(“ column2D”,“ myChartId”,400,300,“ json”,“结果”);

    您必须通过:

    var myChart = new FusionCharts(“ column2D”,“ myChartId”,400,300,“ json”,结果);

    因为result(它是变量)是您的响应,它来自于selectchart.php页面。