javascript - Weird flot behaviour in AJAX calls -
i'm getting weird behaviour when adding flot plots through ajax.
it displays last graph. can confirmed due fact calls asynchronous, , such order of plots random - data being fed flot not issue.
my current code ajax call:
function addgraph(x, y, z){ $.ajax({ datatype: "json", method: "get", url: "/api.php", data: { a: "b", c:$("#d").val(), e: z} }).done(function( plotdata ){ $("#graph").html($("#graph").html() + y.format(x)); $.plot($("#plot-"+x), plotdata.data, plotdata.options); }); }
the y
variable string that's formatted through sprintf
function , looks this:
<div class="col-md-6" style="height:250px;" id="plot-{0}"></div>
Comments
Post a Comment