Skip to content Skip to sidebar Skip to footer

Can't Get Php Variables In The Js Script When Setting Highcharts Head Tag

Below is an extract of my php file (recherche.php) which contains Html and Javascript (JQuery Highcharts) codes and run a MySQL query. But, I can't access the PHP variables when se

Solution 1:

You have to initialize your variables BEFORE echoing them in your JavaScript function. So place the PHP that loads these variables above your <script>

Solution 2:

series: [{
          name: 'average salary',
          data: document.write(data1)
         },  
         {   
          name: 'max salary',
          data: document.write(data2)
         },
         {   
          name: 'min salary',
          data: document.write(data3)
         }]

extra semicolon after document.write(data1/2/3/...)

Post a Comment for "Can't Get Php Variables In The Js Script When Setting Highcharts Head Tag"