Latest web development tutorials

AJAX Examples

To help you understand AJAX works, we create a small AJAX application:


使用 AJAX 修改该文本内容

try it"

AJAX examples of analysis

The above AJAX application contains a div and a button.

div portion for displaying information from the server. When the button is clicked, it is responsible for calling a function named loadXMLDoc () is:

<!DOCTYPE html>

<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>


Next, in the head section of the page to add a <script> tag. The label contains the loadXMLDoc () function:

function loadXMLDoc()
.... AJAX script goes here ...

The following sections will explain your AJAX works.