XML AJAXLesson 25Free preview
AJAX XML File
This lesson is part of XML · All levels
Summary
AJAX can load static XML files from a server, such as a catalog or news list, and then display them to a page. Once a GET request is sent, the response is read with responseXML so that the data immediately forms a DOM tree. The resulting elements are then taken with getElementsByTagName for further processing.
Key points
- XML files are loaded via GET request to the server URL
- ResponseXML returns XML documents in the form of a DOM tree
- Elements taken with getElementsByTagName
- JavaScript loops are used to compile a list of results to a page
- CORS restrictions may prevent loading local XML files
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.