AdamVanBuskirk Report post Posted November 20, 2012 I am getting the error: SyntaxError: missing ; before statement <set label='PowerCharts' value='339800' /> regarding the below code. When I include the exact same XML in a data file and use setXMLUrl instead of setXMLData, it works fine. I tried without the "" at the beginning and end as well as loading the variable chartInfo in PHP first and still the same result. Any help would be greatly appreciated. Thanks. <div id="chartdiv" align="center" ></div> <?php echo " <script type='text/javascript'> var chartInfo = \"\" <chart caption='AVG Days to Completion' subCaption='sub title' showLabels='0' showLegend='1' bgColor='FFFFFF' borderColor='616E9D' borderThickness='5' baseFontColor='FFFFFF' legendbgColor='414E7D'> <set label='test 1' value='232400' /> <set label='test 2' value='339800' /> <set label='test 3' value='411900' /> <set label='test 4' value='398400' /> </chart>\"\"; FusionCharts.setCurrentRenderer('javascript'); var myChart = new FusionCharts('../../FusionCharts/Doughnut2D.swf','chart','400','300','0','1'); myChart.setXMLData(chartInfo); myChart.render('chartdiv'); </script> "; Share this post Link to post Share on other sites
Guest Sashibhusan Report post Posted November 26, 2012 (edited) Hi, Could you please add only one slash "\" just before double quote to escape the double quote in the PHP string variable "chartInfo"? Your Code: var chartInfo = \"\"...\"\"; Replace with: var chartInfo = \"...\"; Also, please remove the "\n" character from the XML string. Please find the below code (modified your code as per the suggestion above mentioned), for your reference. Ref. Code: <?php echo " <script type='text/javascript'> var chartInfo = \"<chart caption='AVG Days to Completion' subCaption='sub title' showLabels='1' showLegend='1' bgColor='FFFFFF' borderColor='616E9D' borderThickness='5' baseFontColor='FFFFFF' legendbgColor='414E7D'><set label='test 1' value='232400' /><set label='test 2' value='339800' /><set label='test 3' value='411900' /><set label='test 4' value='398400' /></chart>\"; FusionCharts.setCurrentRenderer('javascript'); var myChart = new FusionCharts('../../FusionCharts/Doughnut2D.swf','chart','400','300','0','1'); myChart.setXMLData(chartInfo); myChart.render('chartdiv'); </script> "; ?> Hope this helps! Edited November 26, 2012 by Sashibhusan Share this post Link to post Share on other sites