javascript - Running JS-File in php -


i’ve questionnaire analyze php. data supposed displayed in java-based polar-graph , table. can see how looks static data here.

however, graph doesn’t show when use data database. table works fine. few days ago asked how integrate php-data java via json_encode because thought might problem, learned (thanks again) correct approach.

my web-hoster says doesn’t support php in html, modified index.html index.php. have no idea modify make work. database-connection works, php-values in table correct, js-graph works fine static data.

here php-arrays:

$arr1 = array(axis => "gesundheitszustand", value => $x1p); $arr2 = array(axis => "bmi", value => $x3); $arr3 = array(axis => "stress", value => $x10p); $arr4 = array(axis => "körperliche aktivität", value => $x4p); $arr5 = array(axis => "nahrung: gemüse/obst", value => $x8d); $arr6 = array(axis => "nahrung: fisch", value => $x8f); $arr7 = array(axis => "nahrung: fleisch", value => $x8h); $arr8 = array(axis => "geistige gesundheit", value => $x9p); $arr9 = array(axis => "zufriedenheit", value => $x2p); $arr10 = array(axis => "rauchen", value => $x9a); 

the values numbers between 0 , 1.

that’s how try include js-file in php-file:

<html> <head>   <script src="d3js.js"></script>     <script src="radarchart.js"></script> <link rel="stylesheet" href="style.css"> </head> <body> <?php ?>        <script type="text/javascript" src="script.js"></script> <?php ?>  </body> 

and that’s how include php-data js-file:

var d = [           [             <?php echo json_encode($arr1); ?>,             <?php echo json_encode($arr2); ?>,             <?php echo json_encode($arr3); ?>,             <?php echo json_encode($arr4); ?>,             <?php echo json_encode($arr5); ?>,             <?php echo json_encode($arr6); ?>,             <?php echo json_encode($arr7); ?>,             <?php echo json_encode($arr8); ?>,             <?php echo json_encode($arr9); ?>,             <?php echo json_encode($arr10); ?>,                            ],[             {axis:"gesundheitszustand",value:0.63},             {axis:"bmi",value:0.58},             {axis:"stress",value:0.67},             {axis:"körperliche aktivität",value:0.33},             {axis:"nahrung: gemüse/obst",value:0.66},             {axis:"nahrung: fisch",value:0.25},             {axis:"nahrung: fleisch",value:0.50},             {axis:"geistige gesundheit",value:0.68},             {axis:"zufriedenheit",value:0.7},             {axis:"rauchen",value:0.91},           ]         ]; 

although json_encode correct way, has data-integration, correct? or missing something? suggestions? many comments/help in advance!

use echo output string directly


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -