Thursday, August 9, 2007

AJAX is for future of your website. ( Include Tutorial Part I )

AJAX is new technology.


Do you have the blogger account ? you have felt to marvel when adding element or on file article moment automatically as draft of posting. That's AJAX.

According to us, AJAX is a new tehnology where permitting web developers , to developing application based web and to provide a new level of interactivity to their applications.

The term AJAX (Asynchronous JavaScript and XML) was coined by Jesse James Garrett in his article entitled "Ajax: A New Approach to Web Applications".The introduction of Maps and Suggest by Google demonstrated that these methodologies were not only useful, but could work across multiple browsers and were within the reach of the smaller developer.

On the client side, AJAX uses the XMLHTTP object (introduced by Microsoft in Internet Explorer 4.0 and subsequently implemented by the Mozilla Foundation in Firefox, AOL in Netscape, and Opera in the Opera Browser) to retrieve an HTML or XML document from the server. On the server side, AJAX can be as simple or as complex as the developer wants.
How does it works ?
AJAX is programming display events. User is interactivity with these events.And then call functions associated to elements of the web page With forms and buttons, interactivity is achieved. To extract data from XML files provided by server, DOM allows to link elements of this page with actions.

XMLHTTPRequest provide two methods to get data on the server.

- open : Open HTTP connections or create a connections.
- send : Send HTTP request to the server.

Server response a data, and will be found in the attributes of the XMLHTTPRequest object :

- responseXML : Get response body for XML file or
- responseText : Get response body for text file.

For each new file to load XMLHTTPRequest object has to be created.
To process that, we have to wait for the data to be made available. XMLHTTPRequest attribute, readyState give the status of is availibility of data.

AJAX tutorial ( this tutorial is for web developer / programmer )

Before you begin this tutorial, you have to learn about class of XMLHTTPRequest(). DOM technique, and XML programming. And, of course server language knowledge. ( On this tutorial, I use PHP )

XMLHTTPRequest() has 8 attributes :

1. readyState
Get ready state. The code successively changes value from 0 to 4 that means for "ready".
States of readyState follow (only the last one is really useful):
0: not initialized.
1: connection established.
2: request received.
3: answer in process.
4: finished.

2. status
Get HTTP status code.
200 is OK.
404 if the page is not found.

3. responseText
Get response body. Holds loaded data as a string of characters.

4. responseXml
Get response body but as XML. Holds an XML loaded file, DOM's method allows to extract data.

5. onreadystatechange
Register a complete event handler. Property that takes a function as value that is invoked when
the readystatechange event is dispatched.

6. responseBody
Get response body as variant.

7. responseStream.
Get response body as variant.

8. statusText
Get HTTP status text. Like status method, but text response
200 is "OK".
404 is "Not Found".

To be continued to AJAX tutorial part II .....
Posted by Ribhnux at 12:39 AM |  
Labels: , , ,

0 Comments:

Subscribe to: Post Comments (Atom)