AJAX 


          AboutMe      MyCurrentLocation     Blog      GuestBook     Think Big- Possibilities are Endless     HOME

Before We Start always keep this in mind.

AJAX isn't a single technology.Rather it's a collection of 4 technologies that complement each other

whose key elements are Javascript, CSS, DOM and XMLHttpRequest object.

User -----Request---------->Server

User <----Response----------Server

The above is what traditionally happens in a classic web application.

So how does us Ajax help us.Ajax eliminates the start and stop nature of interaction on the web by introducing an intermediary AJAX engine between the client and server. It seems that adding an additional layer would make it less responsive but the opposite is true.

The process that ideally happens over here is that instead of loading a webpage at the start of session, the browser loads an AJAX engine written in Javascript and usually tucked away in a hidden frame.The engine is responsible for both rendering the interface the user sees and communicating with the server on user's behalf.This happens asynchronously so the end user does not ever has to stare a blank webpage with a hourglass.
 

 

XMLHttpRequest is an API that can be used by javascript and any other web browser scripting language to transfer text and XML data between a webpage client's side and server side.

The methods and attributes of the XHR are :

status                200: "OK"        404: Page not found.

onReadyStateChange    Callback method assigned via this attribute

responseText    Holds the response data as a string of characters.
readyState        The readyState code changes value from 0 to 4 during a request cycle:
                0: not initialized.
                1: connection established.
                2: request received.
                3: processing.
                4: finished and response is ready.

Out of all these the most interesting is the XMLHttpRequest object which enables web-programmers to retrieve data from the server as a background activity .The data format received is typically XML but it works well with any text based data.

Within the AJAX technology stack , JavaScript is the glue that binds all the other technology together. Having a basic familiarity with JavaScript is a prerequisite for writing AJAX applications. Being fluent in JavaScript and understanding its strength will enable you to take full advantage of AJAX.


Let's first look into alternatives of AJAX .

This Will enable us to move to better alternatives in case up we land up in a Challenging scenario.These are

  • Macromedia Flash-based solutions
  • Macromedia’s Flex and the open source Laszlo suite, both of which provide simplified server-side frameworks for generating Flash-based business UIs.

Both frameworks use Java/Java 2 Enterprise Edition (J2EE) on the server side. For lower-level control over creating Flash movies dynamically, several toolkits, such as PHP’s libswf module, provide core functionality.

The main downside of Java and .NET technologies is the need to have a runtime preinstalled.Of course, any rich client needs a runtime, but Flash and Ajax (which uses the web browser itself as a runtime) use runtimes that are commonly deployed. Java and .NET runtimes are both very limited in their distribution at present and
can’t be relied on for a public web service.