title: Redrawing Google Pie Chart with AJAX
body: <p>I am using the following pie chart code that is being fed data from a query:</p>
  
  <pre><code> &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
          var data = google.visualization.arrayToDataTable([
            ['Customers', 'Status'],
            ['Accepted',     &lt;?php echo $rowsaccepted ;?&gt;],
            ['Declined',      &lt;?php echo $rowsdeclined;?&gt;],
            ['Not Reviewed',  &lt;?php echo $rowsnreview;?&gt;]
          ]);
  
          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);
        }
      &lt;/script&gt;
  </code></pre>
  
  <p>and the following AJAX call that updates my DB upon clicking a button; therefore updating the chart data, but I must refresh the page for the chart to refresh:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(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");
  
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>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?</p>
  
  <p>Thanks!</p>