Reputation: 212
Hi guys i m trying to pass value from my php to highchart dataset but its not working help needed.
<?php $count2=$decode[nextPage][totalResults];
echo("<input type=hidden name=aaqib value=".$count.">");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var chart;
var j= $("input[name=aaqib]").val();
var k=100;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
title: {
text: 'Logarithmic axis demo'
},
xAxis: {
tickInterval: 1
},
yAxis: {
type: 'logarithmic',
minorTickInterval: 0.1
},
tooltip: {
headerFormat: '<b>{series.name}</b><br />',
pointFormat: 'x = {point.x}, y = {point.y}'
},
series: [{
data: [j,k,
pointStart: 1
}]
});
});
});
</script>
</head>
<body>
<script src="../../js/highcharts.js"></script>
<script src="../../js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
Hi guys i m trying to pass value from my php to highchart dataset but its not working help needed.
i need to use value of J and K in data so that they are shown in highcharts
Upvotes: 0
Views: 510
Reputation: 26320
Store your php
vars into a js
vars and then pass to highcharts
.
Fix the following too.
echo('<input type="hidden" name="aaqib" value="{$count}"/>');
Update according to this comment.
series: [{
data: [[j,k]]
}]
Tthis demo should help you.
Upvotes: 3
Reputation: 14308
why are you echoing the input
above your doctype declaration? I think that belongs inside your body. And you should also '-signs around the attribute values in you echo. something like this:
<?php $count2=$decode[nextPage][totalResults];
echo("<input type='hidden' name='aaqib' value='$count'>");
?>
Some browsers might threat this correctly, but it's actualy invalid html
Upvotes: 0