> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/javascript/mot-vi-du-ve-cach-su-dung-async-tren-w3school.md).

# Sử dụng async và defer full (Oke)

![](/files/-Lx5Ng5OKaFTvVmbqJRS)

![](/files/-Lx5Nk3mDCcA3euH_34G)

![Tương tự với defer thì cũng vậy nó đợi html tải hết nó mới chạy defer](/files/-Lx5PMgm8r6iJb25jRsh)

![](/files/-Lx5Q_tGYLdJPDL5zdKP)

```
<!DOCTYPE html>
<html>
<body>
<p id="p1">Hello World!</p>
<script src="demo_async.js" async></script>
<p><strong>Note:</strong> The async attribute of the script tag is not supported in Internet Explorer 9 and earlier versions.</p>
</body>
</html>
```

```
// demo_async.js
alert(document.getElementById("p1").firstChild.nodeValue);
```

{% file src="/files/-Lx5RTnQWpnNu\_tG8ufe" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://javascriptuse.gitbook.io/javascript/mot-vi-du-ve-cach-su-dung-async-tren-w3school.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
