Asynchronous Javascript and XML Introduction

KeyWords: AJAX, javascript, script, java, xml, tutorial, introduction, chat, web, based, software, coding, programming, program, application

Asynchronous Javascript and XML Introduction
by FrosT

Introduction
After thinking for a long time I have found a good topic to write about. AJAX or Asynchronous Javascript and XML. AJAX is a recently acknowledged language that combines Javascript and XML into one to provide us with truly dynamic content on a web page that was never though possible before. AJAX hit mainstream once Google.com the search engine giant and guru made use of AJAX inside of it's web applications. Well Aeonity.com has recently started using this technology to improve its website and allow users more ways for interaction with each other. Enough of that, lets go in to detail about how Aeonity.com uses AJAX, Asynchronous Javascript and XML.

Web based Chat
Web based chat has been an issue that many sites have wanted for a long time. It used to be you had to have Java, a Sun Microsystems program to run any type of chat. The Java chat would require the Java client and a connection to an IRC channel/server for the chat to be utilized by people. Well not everyone had the Java client and if they did their browser may not support the version they are using. This caused a problem with a lot of web masters wanting a chat that will work for almost anyone without having to download any extra software.

This is where AJAX comes into play. As you can tell on the index page of Aeonity.com AJAX makes it possible for a web page to connect to a database and provide us with a chat in real time without having a page refresh. How this works is there is a Javascript file with code on the back end. When someone hits the submit button, the button does not register on the page but it accesses this Javascript file. The Javascript file than sends a query string to a particular file which in return connects to a database and does error checking etc. Once that is done data is then sent back to the web page via an httprequest, this is where the XML comes into play, which is written to the page dynamically using javascript'swonderful features. Once that is done we format the data that was returned and than display it nicely and update the page to show us what was recently added to the chat.

Users Currently Online
AJAX is very versatile and powerful. In this sense we can show users currently online with little to no delay unlike before. When a user comes online we can send a signal to a file to retrieve the user information and display it on the page. This combined with session data and AJAX we can show users who are currently online. With a more in depth audit trail we can show more information about the user also if desired. Like the current web page they are viewing, how long they have been on the web page, and when they leave the page. Using this logic we can show when a user has logged off and update the current users online instead of having to time them out after a certain amount of time (usually 5 minutes). This can also be seen on Aeonity.com in the Web based chat area also.

Ending Notes
In short AJAX has brought on a new wave for the computer and Internet guru's. It allows for them to use fairly simple code and provide users with truly dynamic content that is generated at the click of a button without a refresh of a page, and is shown to an end user without any interaction at all. Keep in tune because there may be more AJAX tips and tricks to come of what I learn in my experience coding AJAX, Asynchronous Javascript and XML.

Posted by frost on Aug 21st, 2006 20:54 - Subscribe Bookmark and Share


Post a comment:


ReCaptcha:

Posting as anonymous Anonymous guest, why not register, or login now.



Posted by anonymous on October 28th, 2006

this is one of the best articles about ajax that i hav gone through



 

Widget

Hypersmash.com

Extras

  • Not Implemented