Putting data from a database into highcharts with $.getJSON

Putting data from a database into highcharts with $.getJSON

I'm having some problems with $.getJSON, I really need some help because I don't know how to solve the problem and I've been stuck here for days. This is the js file that should generate highcharts when selecting a select option in HTML:

  1. $(document).ready(function() {
  2. $("#paese").change(function(){
  3. var seriesOptions = [];
  4. $.getJSON("prova.php", function(data) {
  5. seriesOptions = data;
  6. });
  7. var chart1 = new Highcharts.Chart({
  8. chart: {
  9. renderTo: 'container',
  10. type: 'column',
  11. spacingLeft: 20,
  12. borderWidth: 1
  13. }
  14.       ....
  15.       series: [{
  16. name: 'Italia',
  17. data: seriesOptions
  18. }],


Is there anything wrong in the first part? When I select an option, it seems like highcharts don't get the php file, but I'm pretty sure it's correct, here it is(PHP file):

  1. <?PHP
  2. $conn = mysql_connect("localhost", "root");
  3. $paese = null;
  4. if(isset($_GET['paese'])) $paese = $_GET['paese'];
  5. $ok = mysql_select_db("liberta", $conn);
  6. $response = array();
  7. $sql="SELECT `valori`.Punteggio FROM `valori` INNER JOIN `nazioni` ON `valori`.Nazione = `nazioni`.ID WHERE `nazioni`.Nome = '$paese'";
  8. $res=mysql_query($sql);
  9. while($record=mysql_fetch_row($res)){
  10. $response[] = intval("$record[0]");
  11. }
  12. mysql_close($conn);
  13. print(json_encode($response));

I'm trying to get the data from a database I created with PHPmyadmin and put them directly into highcharts, but it doesn't work. I'd be very pleased if you could help me, also because this is is an exam I have to sit. Thank you very much.