javascript - Weird flot behaviour in AJAX calls -


i'm getting weird behaviour when adding flot plots through ajax.

this result: enter image description here

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

Popular posts from this blog

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

php - Issues outputting data after prepared statement with loops -

javascript - How to pass a property by reference -