Javascript Ajax demo

Demo of Javascript fetching information from a server in the background in response to user actions, without reloading the page.

Note for security reasons a script (which uses XMLHttpRequest) can only read a file on the same server as the script - not from 3rd party servers.

Based on the Reading Server Data script in the book JavaScript and Ajax for the Web by Tom Negrino and Dori Smith.

Simple links to TXT and XML.

Retrieve TXT and XML.


It doesn't have to be a link. Retrieve XML when click image (which is not a link):