I am trying to use google charts on my page to display stuff from google analytics.
我试图在我的页面上使用谷歌图表来显示谷歌分析的东西。
I have split my analytics reports into more sections: Pages, Browsers, Operating Systems, Traffic sources etc...
我将分析报告拆分为更多部分:页面,浏览器,操作系统,流量来源等......
I have a handler which gets my request and performs an ajax call to one of my files. For example: if i request Pages, my handler shows the ajax loading graphic and sends a request to ajax_pages.php. When finished it appends the html in a div.
我有一个处理程序来获取我的请求并对我的一个文件执行ajax调用。例如:如果我请求Pages,我的处理程序会显示ajax加载图形并向ajax_pages.php发送请求。完成后,将html附加到div中。
Here's the problem: putting google charts code in any of the ajax_*.php files will not load the js...AT ALL! Any other javascript code will load. Have tried <script>alert('aaaa');</script>
and worked fine. The things is that the js code does not even appear when i View Source of the page. How could this be? At least to source code should be there no matter if it has errors.
这是问题所在:将google图表代码放在任何ajax _ *。php文件中都不会加载js ... AT ALL!任何其他JavaScript代码将加载。尝试过
Putting the code before the handler sends the request will display the charts.
将代码放在处理程序之前发送请求将显示图表。
1 个解决方案
#1
5
google.load tries to write to an already finished document. My solution was to amend my loading script with a callback:
google.load尝试写入已完成的文档。我的解决方案是使用回调修改我的加载脚本:
google.load("visualization", "1", {"packages": ["corechart"], "callback": drawFlyAtlasChart});
#1
5
google.load tries to write to an already finished document. My solution was to amend my loading script with a callback:
google.load尝试写入已完成的文档。我的解决方案是使用回调修改我的加载脚本:
google.load("visualization", "1", {"packages": ["corechart"], "callback": drawFlyAtlasChart});