谷歌饼图加载后,ajax加载


google pie chart loading after ajax loads

我一直在使用google饼状图和jquery Ajax.Load()

我的问题是饼状图只有在ajax加载调用返回后才加载,这是相当缺失的一点,让页面加载(包括图表),然后异步加载重内容。

http://code.google.com/apis/chart/interactive/docs/gallery/piechart.html

饼状图加载方式:

google.setOnLoadCallback(drawChart);

和Ajax调用类似:

$("#id").load(url, function(response, status, xhr) {
  if (status == "error") {
    alert(xhr.status + " " + xhr.statusText);
  }
  else {
      $("#id").show(); 
  }
});

我怎么能使谷歌饼图加载发生之前,ajax加载完成?

为什么不在drawChart方法中执行下面的代码呢?这实际上是绘制图表的回调方法

$("#id").load(url, function(response, status, xhr) {
  if (status == "error") {
    alert(xhr.status + " " + xhr.statusText);
  }
  else {
      $("#id").show(); 
  }
});