Fortunately, jQuery provides a built-in utility function, $getScript() provides us with such a method. To implement dynamic functions on web pages. Let’s take a look at the syntax of this function:
$.getScript(url,callback)
Get the script specified by the url parameter and use a GET request to the specified server
Parameters
URL() gets the URL of the script file.
callback (Function) optional function calls the function inside the script file after loading
The specific implementation process is
loading text from resources
|If character If the string is successful,
returns the XHR instance, which is used to obtain the script.
How to use it? See the method below
We create a new.js script file