AJAX Examples


To help you understand how AJAX works, we have created a small AJAX application:

Examples

Use AJAX to modify this text content


Try it Yourself »


AJAX Example Analysis

The AJAX application above contains a div and a button.

The div section is used to display information from the server. When the button is clicked, it is responsible for calling a function named loadXMLDoc():

<div id="myDiv"><h2>Use AJAX to modify this text content</h2></div> <button type="button" onclick="loadXMLDoc()">Modify Content</button>

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

<head> <script>function loadXMLDoc() { .... AJAX script execution ... }</script> </head>

The following chapters will explain how AJAX works.

Other Extensions