0

我一直在使用谷歌饼图和 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 加载完成之前使谷歌饼图加载发生?

4

1 回答 1

1

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

$("#id").load(url, function(response, status, xhr) {
  if (status == "error") {
    alert(xhr.status + " " + xhr.statusText);
  }
  else {
      $("#id").show(); 
  }
});
于 2011-08-03T18:05:30.480 回答