I would like to know how to load an external Javascript into my document from a function.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Get it with AJAX and then eval() the code.
This is one way:
The @seth's answer is completely right, but you don't need to leave the inserted
script
element on the DOM, you can remove it just after it is loaded, and also you might want to know when the inserted script is ready to use, for example you can:Usage: