I'd like to plot a simple graph using data from PHP and jqplot.
In PHP I simply did this:
$test = array('1' => '2', '3' => '4');
echo json_encode($test);
The result that I get on js side is: {"1":"2","3":"4"}, I checked this.
So, I've tried to plot this simple array but no luck:
$.ajax({
type: "POST",
url: "ajax.php",
data: "fname="+ fname +"& lname="+ lname,
dataType:"json",
success: function(data)
{
$('#dissapear').hide(function(){$('#chartdiv').css("height:400px;width:300px;");$('#chartdiv').fadeIn();});
$.jqplot
('chartdiv', [data],
{
title:'Jitter',
axes:{yaxis:{min:0,max:240},xaxis:{renderer:$.jqplot.DateAxisRenderer}},
series:[{lineWidth:4, markerOptions:{style:'square'}},{ show: true } ]
}
);
What did I miss? Please help me out, I've tried at least 20 code combinations but no luck. And yeah, I did look at dataRenderer examples in jqplot, but it didn't help me.