AJAX can be used for interactive communication with an XML file.
The following example will demonstrate how a web page can fetch information from an XML file with AJAX:
See this example:
When a user clicks on the "Get CD info" button above, the loadDoc() function is executed.
The loadDoc() function creates an XMLHttpRequest object, adds the function to be executed when the server response is ready, and sends the request off to the server.
When the server response is ready, an HTML table is built, nodes (elements) are extracted from the XML file, and it finally updates the element "demo" with the HTML table filled with XML data:
The XML file used in the example above looks like this: "cd_catalog.xml".