Ive never used the plot plugin, but im guessing that its second parameter
accepts an array, am i right?
If im try to parse the result into an array then do your call:
array=[];
array=transformToArray(result);
$.plot($("#graph"), array);


2009/6/3 abhis...@uottawa <abhishe...@gmail.com>

>
> Hi,
> I'm kinda a newbie to jquery and am stuck with a project I'm trying. I
> am using the flot graphing library to plot a couple of graphs. But I
> want to be able to
> load different data sets into my graphing canvas by using ajax. Here
> is what I have so far:
>
> <script type='text/javascript'>
> $(function(){
> $("a.hotels").click(function() {
> //the main ajax request
> $.ajax({
> type: "POST",
> data: "action=hotel",
> url: "votes.php",
> success: function(result) {
> $.plot($("#graph"), [ result ]);
> }
> });
> });
> });
> </script>
>
> The response I get from the votes.php file looks like this
>
> [1.2438141E+12,60],[1.2437277E+12,53],[1.2436413E+12,60],[1.2435549E
> +12,59],[1.2434685E+12,55],[1.2433821E
> +12,59],[1.2432957E+12,60],
>
> which is plottable by flot. My only problem is, how do I insert that
> response inplace of 'result' in the success funtion. Currently it only
> comes out as 'result' if I view the source of my page, but if I add
> $("span#output"+the_id).html(msg);
> to the success function, then I do see my output correctly.
> Any help would be greatly appreciated, thanks.
>



-- 
Gustavo Salome Silva

Reply via email to