California Ajax Solutions Team

www.CalAST.com

While many techniques can be used to achieve this result, the most common one used today is called Ajax. Ajax is an acronym for Asynchronous JavaScript And XML, although Jesse James Garrett - who coined the term - prefers to see it spelled "Ajax" and not "AJAX." It is not a programming language, it is just a way of using existing technologies in a new way to implement more interesting web sites. It includes a number of technologies under the Ajax "umbrella", such as XHTML and CSS for presentation, the DOM for display manipulation, XML for data interchange, the XHR for sending packets between client and server, and JavaScript for client-side programming. Server side programming is generally done in PHP, although not always. Well, that's a lot of acronyms, some of which you probably know and others you may not have heard of. I'll try to clarify as we go along.

First, though, I'd like to point out a general characteristic of Ajax applications. That is, there is some separation of foreground and background activity. The foreground activity is the initial request and response to retrieve the web page from the server, plus whatever the user is doing with it at the moment - like filling in a form or choosing one of several options. The background activity consist of exchanges between the client and server to support foreground activity. Consider autocomplete, a widely used technique where, as you type, a restricted set of choices that match what you have entered so far is displayed. You can then just choose one item from a list instead of typing in the full entry. This uses background requests to the server to obtain (and display) meaningful choices that match what you have entered in the forground.

The asynchronous aspect of the technique is that information can be requested from the web server, and the browser (and user) can continue doing other things until the request is answered. However, Ajax does not have to be asynchronous, and there are times when it only makes sense to wait for the response before continuing. For example, you might need to display the returned information immediately. But it is often useful to exchange information between the client and server as a background activity without disturbing the currently loaded web page - or what the user is doing with it. This is done asynchronously.

XML is a meta-language for describing structured data. It looks a lot like HTML, except the tag names are pretty much up to the designer. But XML is not required for Ajax. There are competing formats for structured data (JSON, or JavaScript Object Notation, being the most popular). It's also perfectly reasonable to return unstructured data as a simple string or a list of comma-separated values. If you need to ask the server for the user's first name, it can just return "Bob" and doesn't need to encapsulate it in XML or anything else. So if you don't need asynchronous behavior, and you don't need XML, you presumably don't really need "and" either, just leaving you with JavaScript. And you could use this technique with another language.

JavaScript is a client-side scripting language - that is, it runs as part of your browser on the client machine (your computer), not on the web server. It was originally invented by Netscape, and is generally available in all browsers except for very primitive ones that run on simple mobile devices. It has nothing to do with Java (other than some similar syntax), and is more properly called ECMAscript these days - although few people do. Microsoft attempted to implement its own version (Jscript) but all Microsoft browsers support JavaScript - although sometimes in a slightly quirky way. When your web site needs to execute some program fragment on the client machine, it will likely be written in JavaScript. We'll talk about what such code does in a moment.

Next

Some structured data

XML:

<employee>
  <name>Tom Brady</name>
  <title>quarterback</title>
  <emplNum>12</emplNum>
</employee>