How to implement the corresponding callback function after loading using JS script

亚连
Release: 2018-06-02 15:10:13
Original
1359 people have browsed it

This article mainly explains how to execute the corresponding callback task after successfully loading the js file. Friends who are interested in the operation method of executing the corresponding callback function after the JS script is loaded can learn from this article.

Frequently used in projects You will encounter such a problem: when a js script is loaded, the corresponding task will be executed, but many friends may not know how to judge whether the js file we want to load has been loaded. If it is not loaded, we will call the js file. The function will not succeed. This article mainly explains how to execute the corresponding callback task after successfully loading the js file.

Basic idea

We can dynamically create the