jquery flot with ajax not working – Education Career Blog

var options = {
    series: {lines: {fill: true, fillColor: "rgba(255, 255, 204, 0.5)"} },
    xaxis: { mode: "time", timeformat: "%d %b %y", minTickSize: 1, "month"}    ,
    yaxis: { max: 50000}
};
var d3;
var plot;
$(document).ready(function(){
    d3 = <?echo $balarray;?>;
    plot = $.plot($("#placeholder"), d3,options );
    $("#calInput1").blur(function(event){
        $(this).clear();
    });
    $('#show').click(function(){
        $.post("/sandbox/graphloader",{calInput1:$('#calInput1').val(), calInput2:$('#calInput2').val()} ,function(data) {

            plot.setData(data);
            plot.draw();
        });
    });
}); 

I am trying to do ajax call to a kohana controller with this. I want to redraw it on click of a button. why isn’t the redraw working ?? (At load it is showing the graph fine)

,

You probably need to deserialize the string (data), jquery/javascript does not make assumption about the type of data returned by the ajax result.

Leave a Comment