Sorry for the noob question. I've read through a couple questions and am unable to solve my problem. I cannot seem to load the data.
I have the following json code output from a php script.
{label: "load",data:[[1283294013*1000, 2.03],[1283293998*1000, 2.04],[1283293983*1000, 2.06],[1283293968*1000, 1.99],[1283293953*1000, 1.98],[1283293937*1000, 1.98],[1283293922*1000, 1.97],[1283293907*1000, 1.97],[1283293892*1000, 1.96],[1283293877*1000, 1.95],[1283293862*1000, 2.03]]}
With the following options
var options = {
legend: {
show: true,
margin: 10,
backgroundOpacity: 0.5
},
lines: { show: true },
xaxis: {
mode: "time",
timeformat: "%H:%M"
},
yaxis: { min: 0, },
grid: { hoverable: true }
};
The actual script looks like the following
var plotArea = $("#plotArea");
plotArea.css("height", "450px");
plotArea.css("width", "800px");
$.getJSON("getStats.php", function(data) {
alert(data);
$.plot( plotArea , data, options );
});
The alert doesn't load at all. With FireBug, I can see the data was returned but nothing happens.
When using the following instead, data passes. The alert runs and a graph shows up with nothing on the graph.
$.get("getStats.php", function(data) {
alert(data);
$.plot( plotArea , data, options );
});
I can get this to run when just including the getStats.php in the code but that's not really what I'm shooting for.