google.setOnLoadCallback with jQuery $(document).ready(), is it OK to mix?

后端 未结 4 1595
不思量自难忘°
不思量自难忘° 2020-11-30 23:59

I\'m using Google Ajax API and they suggest I use google.setOnLoadCallback() to do various things related to their API but I\'m using also jQuery\'s $(doc

4条回答
  •  独厮守ぢ
    2020-12-01 00:27

    Why mix when you can do it all with $(document).ready()? Just get rid of the google.setOnLoadCallback function and use jQuery's $(document).ready().

    This:

    google.setOnLoadCallback(chartEnrollment);
    

    becomes

    $(document).ready(chartEnrollment);
    

提交回复
热议问题