I'm working on a project for school, I have to take data from a db (created on PhPMyAdmin) and create a graphic. I use PHP for get the data and Javascript to create the graphic, but I found and error and I can't get rid of it: when i lunch my html file the graphic structure appears, but it's empty. If I check Firefox console I get the error: ‘no element found’ and it's refered to php file.
PHP code:
<?php
require("conf.php");
$query="SELECT * FROM straniera";
$result=mysql_query($query);
$i=0;
$valori = array();
while($row=mysql_fetch_array($result)) {
$valori[$i]=$row['2011'];
$i++;
}
return $valori;
?>
Javascript code that lunch php:
var d = $.ajax({
type: "POST",
url: 'try.php'
});
graphic(d);
echosomething notreturnit. However you can't just echo an array like this and expect it to work in javascript