loading javascript file after jquery.ready

后端 未结 4 1438
轮回少年
轮回少年 2020-12-28 22:27

I want to load a javascript file at the end of jquery.ready so that the code in my ready handler doesn\'t have to wait to execute until this large javascript file is loaded.

4条回答
  •  太阳男子
    2020-12-28 22:59

    Use .getScript: http://api.jquery.com/jQuery.getScript/

    $(document).ready(function(){
        ...
        ...
        $.getScript("largejs.js");
    });
    

提交回复
热议问题