AJAX (Asynchronous JavaScript and XML) is a technique that allows web pages to make 'behind the scenes' communications with web servers without having to reload the entire web page. When combined with DHTML, AJAX can be used to reload portions of the current web page with fresh data from the server. This can be used to create much 'slicker' web applications.
This article contains some experiments, please feel free to look at the source to see the underlying JavaScript.
For more information about AJAX, visit WikiPedia's AJAX article
Performing a HTTP GET
This page simulates a username availability check making a behind the scenes trip to the server (without reloading the whole page).
The server's XML response will always indicate that it the username is unavailable.
Performing a HTTP POST
Lets play the Higher or Lower game.
Observations
Cookies - when the browser performs a XMLHTTPRequest operation it automatically sends the current cookies (for free!). This is essential for applications that require session authentication.
Permission Denied error - the XMLHTTPRequest object will only perform a POST to scripts on the same web site. Attempt to POST to scripts on other web sites triggered a Permission Denied error. This will be to prevent nasty cross-site scripting attacks.
Sadly, these AJAX samples do not work in the PocketPC's version of Internet Explorer.
The initial ideas explored here were inspired by this article:
http://www.xml.com/pub/a/2005/02/09/xml-http-request.html
This article contains some experiments, please feel free to look at the source to see the underlying JavaScript.
For more information about AJAX, visit WikiPedia's AJAX article
Performing a HTTP GET
This page simulates a username availability check making a behind the scenes trip to the server (without reloading the whole page).
The server's XML response will always indicate that it the username is unavailable.
| Enter a username: | This name is in use, please try another. |
Performing a HTTP POST
Lets play the Higher or Lower game.
| Guess my number: |
Observations
Cookies - when the browser performs a XMLHTTPRequest operation it automatically sends the current cookies (for free!). This is essential for applications that require session authentication.
Permission Denied error - the XMLHTTPRequest object will only perform a POST to scripts on the same web site. Attempt to POST to scripts on other web sites triggered a Permission Denied error. This will be to prevent nasty cross-site scripting attacks.
Sadly, these AJAX samples do not work in the PocketPC's version of Internet Explorer.
The initial ideas explored here were inspired by this article:
http://www.xml.com/pub/a/2005/02/09/xml-http-request.html
212 comments,
Web, Tuesday, June 7, 2005 20:43


