I am using the following pie chart code that is being fed data from a query:

 <script type="text/javascript" src="https://www.google.com/jsapi";></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Customers', 'Status'],
          ['Accepted',     <?php echo $rowsaccepted ;?>],
          ['Declined',      <?php echo $rowsdeclined;?>],
          ['Not Reviewed',  <?php echo $rowsnreview;?>]
        ]);

        var options = {
                       'width':200,
                       'height':200,
                       'backgroundColor':'#474747',
                       'legend': 'none',
                       'chartArea':{left:20,top:0,width:250,height:250},
                       colors: ['#ef8200', '#007fc2', '#41cf0f'],
                       fontSize:14,

                   };

        var chart = new 
google.visualization.PieChart(document.getElementById('piechart'));
        chart.draw(data, options);
      }
    </script>


and the following AJAX call that updates my DB upon clicking a button; 
therefore updating the cart data, but I must refresh the page for the chart 
to refresh:

<script type="text/javascript">
$(function() {
$(".decline").click(function(){
  
var element = $(this);
var del_id = element.attr("id1");
var order_id = element.attr("data-order1");
 $.ajax({
   type: "POST",
   url: "decline.php",
   data: {id1:del_id,order_id1:order_id},
   success: function(){cache: false}
});
  $(this).parents(".show").animate({ backgroundColor: "#003" }, "slow")
  .animate({ opacity: "hide" }, "slow");

});
});
</script>

Is there any way I can add a call in my AJAX function that will refresh and 
redraw the pie chart without requiring the page to be refreshed?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to