Dynamically loading JavaScript synchronously

后端 未结 18 2329
小蘑菇
小蘑菇 2020-11-27 13:55

I\'m using the module pattern, one of the things I want to do is dynamically include an external JavaScript file, execute the file, and then use the functions/variables in t

18条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 14:51

    same as Sean's answer, but instead of creating a script tag, just evaluate it. this ensures that the code is actually ready to use.

提交回复
热议问题