Home Web Front-end JS Tutorial Relatively simple code for asynchronously loading JS files_javascript skills

Relatively simple code for asynchronously loading JS files_javascript skills

May 16, 2016 pm 06:49 PM
asynchronous

Copy code The code is as follows:

<script> <br>function getJsFile(url, callBack){ <br>var <br>if(XH.readyState == 4 && XH.status == 200){ <br>if(window.execScript) window.execScript(XH.responseText); <br>else eval.call(window, XH. responseText); <br>eval(callBack)(); <br>} <br>} <br>XH.send(''); <br>} <br></script>



//test
<script> <br>function cb(){ <br>alert(1); <br>abc(); //This is in js9.js <br>} <br>getJsFile('http://www.jb51.net /images/test.js,'cb'); <br></script>

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files With the development of the Internet, the file download function has become one of the basic needs of many websites and applications. For scenarios where multiple files need to be downloaded at the same time, the traditional synchronous download method is often inefficient and time-consuming. For this reason, using PHP to download multiple files asynchronously over HTTP has become an increasingly common solution. This article will analyze in detail how to use PHP asynchronous HTTP through an actual development case.

How Swoole supports asynchronous SMTP operations How Swoole supports asynchronous SMTP operations Jun 25, 2023 pm 12:24 PM

With the continuous development and popularization of the Internet, email has become an indispensable part of people's lives and work, and SMTP (Simple Mail Transfer Protocol) is one of the important protocols for email sending. As an asynchronous network communication framework for PHP, Swoole can well support asynchronous SMTP operations, making email sending more efficient and stable. This article will introduce how Swoole supports asynchronous SMTP operations, including using sync

Advanced Guide to Python asyncio: From Beginner to Expert Advanced Guide to Python asyncio: From Beginner to Expert Mar 04, 2024 am 09:43 AM

Concurrent and Asynchronous Programming Concurrent programming deals with multiple tasks executing simultaneously, asynchronous programming is a type of concurrent programming in which tasks do not block threads. asyncio is a library for asynchronous programming in python, which allows programs to perform I/O operations without blocking the main thread. Event loop The core of asyncio is the event loop, which monitors I/O events and schedules corresponding tasks. When a coroutine is ready, the event loop executes it until it waits for I/O operations. It then pauses the coroutine and continues executing other coroutines. Coroutines Coroutines are functions that can pause and resume execution. The asyncdef keyword is used to create coroutines. The coroutine uses the await keyword to wait for the I/O operation to complete. The following basics of asyncio

How Swoole supports asynchronous AMQP operations How Swoole supports asynchronous AMQP operations Jun 25, 2023 am 08:22 AM

As the volume of Internet business continues to grow, the demand for high concurrency and high performance is getting higher and higher, and Swoole, as a network communication framework for PHP, is increasingly favored by developers. Among them, Swoole supports asynchronous AMQP, which is one of the more common application scenarios. So let's take a look at how Swoole supports asynchronous AMQP operations. First, we need to clarify what AMQP is. AMQP (AdvancedMessageQueuingProtocol) Advanced

How to use the asynchronous request function in the Vue documentation How to use the asynchronous request function in the Vue documentation Jun 20, 2023 pm 05:55 PM

Vue.js is a popular front-end JavaScript framework that provides a way to build user interfaces in your applications. In the Vue.js documentation, we can find a lot of useful information, especially about how to use asynchronous request functions. Asynchronous request functions are a way to perform asynchronous tasks in an application. They are used to get data from the server, process input, validate forms, etc. Generally speaking, asynchronous request functions need to be combined with Java functions such as Promise, async and await.

PHP asynchronous coroutine development: speed up data caching and read and write operations PHP asynchronous coroutine development: speed up data caching and read and write operations Dec 18, 2023 pm 01:09 PM

PHP asynchronous coroutine development: accelerating data caching and read and write operations. In actual application development, data caching and read and write operations are common performance bottlenecks. In order to improve system efficiency and user experience, PHP asynchronous coroutine technology can be used to accelerate these operations. This article will introduce the basic concepts and principles of PHP asynchronous coroutines and provide specific code examples. 1. The concept and principle of asynchronous coroutine Asynchronous coroutine is an efficient concurrent programming technology that uses a single thread to achieve lightweight task scheduling and collaboration. Compared with traditional multi-threaded or multi-process concurrent programming

Asynchronous and non-blocking technology in Java exception handling Asynchronous and non-blocking technology in Java exception handling May 01, 2024 pm 05:42 PM

Asynchronous and non-blocking techniques can be used to complement traditional exception handling, allowing the creation of more responsive and efficient Java applications: Asynchronous exception handling: Handling exceptions in another thread or process, allowing the main thread to continue executing, avoiding blocking. Non-blocking exception handling: involves event-driven exception handling when an I/O operation goes wrong, avoiding blocking threads and allowing the event loop to handle exceptions.

How to use ThinkPHP6 for asynchronous logging operations? How to use ThinkPHP6 for asynchronous logging operations? Jun 12, 2023 am 09:57 AM

With the rapid development of the Internet, logging services have become an essential module for every large-scale web application. In order to facilitate various needs such as error troubleshooting and performance monitoring, this article will introduce how to use the ThinkPHP6 framework to perform asynchronous logging operations. 1. What is logging? In the field of computer science, logging refers to recording events and information that occur in a computer system. Typically, these records are stored in files or databases. Logging helps to understand the system operating status, detect and solve problems in a timely manner

See all articles