title: Uncaught reference error - function is not defined
body: <pre><code>function generatePieChart(chartData, counter='', diffSeparator=''){     
    var chart;
    var legend;
  
  //chartData = "["+chartData+"]";                        
  
  AmCharts.ready(function () {
      // PIE CHART
      chart = new AmCharts.AmPieChart();
      chart.dataProvider = chartData;
      chart.titleField = "stage";
      chart.valueField = "enquiryCount";
      chart.depth3D = 10;
      chart.angle = 10;
  
      // LEGEND
      legend = new AmCharts.AmLegend();
      legend.align = "center";
      legend.markerType = "circle";
      chart.balloonText = "[[title]]&lt;br&gt;&lt;span style='font-size:14px'&gt;&lt;b&gt;[[value]]&lt;/b&gt; ([[percents]]%)&lt;/span&gt;";
      //chart.addLegend(legend);
  
  
      // WRITE
      chart.write("chart_div_"+diffSeparator+"_"+counter);
  });
  
  
  }
  
  generatePieChart(&lt;?=$data?&gt;,'&lt;?=$i?&gt;','o');
  </code></pre>
  
  <p>I am trying to generate graphs as it needs to be generated 10 times. So, instead of placing the complete jquery, i created the generation section to a function as you can see. Then while calling the function, it is providing me error saying "Uncaught reference error".
  I also checked many of the post's describing different solution. I tried all of them but none of them worked.
  And the most annoying thing is that, the same script works in firefox but not in chrome.</p>