How do I load a variable number of scripts with jQuery.getScript() before running javascript code?

前端 未结 6 432
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 20:10

I need to load a variable number of javascript source files before running javascript code that depends on them. Sometimes 1 script needs to be loaded, other times 2. The ge

6条回答
  •  -上瘾入骨i
    2021-01-12 20:43

    Wrote this earlier tonight, but I promise I'm not a plant. ;-) In addition to LabJS and RequireJS, there's also Head.js which is dead simple to use and does exactly what you want.

提交回复
热议问题