Привет всем, я пытаюсь понять, как это будет работать.Я не знаю, почему я всегда получаю пустую страницу
Вот мой код
из index.html
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["annotatedtimeline"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
//Tell Google Visualization where your script is
var query = new google.visualization.Query('/vis.php');
query.setQuery('select thedate,visits,sales from dothefetch');
query.send(function(result) {
if(result.isError()) {
alert(result.getDetailedMessage());
} else {
var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
chart.draw(result.getDataTable(), {'colors': ['green', 'blue'], displayAnnotations: true, 'zoomStartTime': new Date(2011, 3 ,1), 'zoomEndTime': new Date(2011, 3 ,2) });
}
});
}
</script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
И из моего vis.php
<?php
require_once 'lib/MC/Google/Visualization.php';
$user = 'root';
$db = new PDO('mysql:host=localhost;dbname=mywebsite',$user,'');
$vis = new MC_Google_Visualization($db,'mysql');
/*
foreach($db->query('SELECT * from total') as $row) {
print_r($row);
}
*/
$vis->addEntity('dothefetch', array(
'fields' => array(
'thedate' => array('field' => 'thedate', 'type' => 'datetime'),
'visits' => array('field' => 'visits', 'type' => 'number'),
'sales' => array('field' => 'sales', 'type' => 'number')
)
));
$vis->setDefaultEntity('dothefetch');
$vis->handleRequest();
?>
Может кто-нибудь сказать мне, где я пропустил?Я всегда получаю пустую страницу