This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11800|Reply: 1

[Jquery] jquery loads js with ajax

[Copy link]
Posted on 1/8/2016 6:22:10 PM | | |

Someone in the group today asked how to load js with ajax, and I haven't used it yet. I asked why I used ajax to load JS, and I learned that the js file is very large, and it needs to be loaded when the user clicks a certain button, and it usually does not need to be loaded. In this way, loading js with ajax seems necessary in some cases.

So I entered ajax into Google to load js, and saw that the first one turned out to be an article on my website, and the content of the article was loaded js using Google API, which may be that the title of my article is not very standardized. After checking the jQuery documentation, there is a ready-made method to load the js file, how to use it as follows:






For example, in jsname.js file there is a statement:




In this way, first output "ajax load js", wait for the file to be loaded jsname.js complete, execute the callback method, and output "ajax load js complete the method to be executed". This is considered to be the loading of ajax js.




Previous:sql SELECT
Next:Let's post a few funny pictures and jokes from the trial process
 Landlord| Posted on 12/26/2024 10:45:43 AM |
Native JS ingestion loads js files:

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com