can you give the entire code of both pages so we can look at it more closely?
On Sat, Nov 5, 2011 at 4:51 AM, Aaron Marden <[email protected]> wrote: > I have seen this problem posted in other posts, but people seem to > figure it out without going into detail on how to actually fix it. I > am trying to dynamically populate a visualization chart using Ajax. > When I go to the Page 1 which generates the data and chart, the graph > is drawn successfully. However, when I try to call it from another > page (Page 2) through Ajax nothing happen. I have used inspect element > in Chrome and I can see the javascript being written into Page 2 from > Page 1, however I am not sure how to then get the page to draw the > chart. When I add a button or use google.load to run the drawChart > function in Page 2, it states that drawChart does not exist even > though I can see the javascript in the console when using inspect > element. Below is the script that works in Page 1 that gets inserted > into Page 2: > > Page 1: > <script type="text/javascript"> > function drawChart () { > data = new google.visualization.DataTable(); > data.addColumn('string', 'x'); > //Below here is the data > data.addColumn('number', '000');data.addRow(['1', > 0]);data.addRow(['2', 0]);data.addRow(['3', 0]);data.addRow(['4', > 0]);data.addRow(['5', 0]);data.addRow(['6', 0]);data.addRow(['7', > 0]);data.addRow(['8', 0]);data.addRow(['9', 0]);data.addRow(['10', > 0]);data.addRow(['11', 0]);data.addRow(['12', 0]);data.addRow(['13', > 0]); > // Below here is the chart options > var options = {'title':'000 Trend', > 'width':600, > 'hAxis':{'title':'Patient Visit Number'}, > 'vAxis.title':'000', > 'height':300}; > var chart = new > google.visualization.LineChart(document.getElementById('charts2')); > chart.draw(data, options); > } > google.load('visualization', '1.0', {'packages':['corechart'], > callback:drawChart}); > </script> > > Finally, I have not been getting any errors in javascript console. > Does anyone know how I could get this to work? I have been reading a > lot of google documentation, but I am fairly new at coding and have > not been able to understand all of it. Let me know if I should post > more code to help figure this out. Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > 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. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. 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.
