I'm (trying to) using JSON with PHP.
I want to plot a graph using this plugin: http://www.jqplot.com The problem is: It's being plot before the new data arrives. Is there anyway to make jQuery wait for the $.getJSON() and the plot it?
myArray
and title
are the new data that will be used later.
$.getJSON('./ajax/refreshData.php', function(data) {
myArray = data.arrayName;
newTitle = data.newTitle;
});
plot1 = $.jqplot('divname', [ myArray ], {
series : [ {
renderer : $.jqplot.BarRenderer} ],
title : newTitle,
...