I want to put google chart into开发者_如何学C window.onload, but it doesn't show anything instead, in the status bar, it shows 'Transferring data from www.google.com...' I know if we put the code outside window.onload it will surely work, but I want to put in window.onload. Any suggestions? thanks
Here is my code

drawChart callback should be invoked when API would be loaded, for that you need to define callback key in third argument of google.load function:
(function(window, document, undefined) {
window.onload = function() {
google.load('visualization', '1', {
packages:['corechart'],
callback: drawChart
});
function drawChart() {
console.log('drawChart');
}
};
})(window, window.document);
加载中,请稍侯......
精彩评论