将带有谷歌图表的外部页面加载到div中

时间:2012-06-22 01:23:15

标签: jquery html charts external

以下是google图表in.php的代码:

<html><head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>            
<script type="text/javascript">       
 google.load('visualization', '1.0', {'packages':['corechart']});           
 google.setOnLoadCallback(drawChart);      
   function drawChart() {       
        var data = new google.visualization.DataTable();          
        data.addColumn('string', 'Topping');         
        data.addColumn('number', 'Slices');         
        data.addRows([  ['Mushrooms', 3],  ['Onions', 1],            
                        ['Olives', 1],  ['Zucchini', 1], ['Pepperoni', 2] ]);          
   var options = {'title':'Pizza I Ate Last Night',    
                       'width':400,  'height':300};  
        var chart = new google.visualization.PieChart(document.getElementById
                    ('chart_div'));} 
 </script>   
 </head>    
 <body>          
 <div id="chart_div"></div></body> </html>

我的页面的代码将其加载到div:

<html>
<head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> 
<script type="text/javascript" src="https://www.google.com/jsapi"></script>  
<script>
$(document).ready( function () { $('#page').load('in.php');});
</script>
</head>
<body>
<div id=page style="width: 900px; height: 500px;" ></div>
</body>
</html>

in.php单独工作正常,但没有out.php和loading out.php会在源代码中显示空白页面和错误。在此先感谢!!!

0 个答案:

没有答案