The KillerAjax FAQ about Ajax
October 1, 2006
by: Richard Mischook – www.killersites.com, www.killerajax.com
Are these really questions from actual users?
OK you got us. Truth be told, the AJAX section of the site is relatively new, so we had to kick back and use our imaginations a bit. That said we feel we have a pretty good feel for the sorts of questions are users might be asking themselves and that’s what we have presented here.
If you would like to ask your own question please feel free to join in the forum.
So what is this Ajax thing I keep hearing about?
Ajax is actually an acronym which stands for Asynchronous Javascript and Xml. The term Ajax is used to indicate the main technologies used to build Ajax-enabled web sites. From a user’s point of view an Ajax user interface looks and feels less like a web page and more like an actual application.
The most obvious feature of this is usually that a user can do things that cause what they see in their web browser to change, without the whole page having to be reloaded (for example add an item to a shopping cart).
What kind of web site would benefit from being Ajax-enabled?
Ajax is about providing the user with an interface that is more application-like and less like a web page. So it stands to reason that web applications would be the best candidates for Ajaxification. More specifically any site that is dynamic in nature and requires a fair amount of user interaction is what we are talking about.
For instance if your site is an online diary where the user simply reads what you have written – well not much use for Ajax here. But if users can respond and post comments then this might make it a candidate for a little Ajax.
If on the other hand your site has lots of things that a user could be doing, some of which take awhile but can happen in the background, then you probably have an ideal candidate site for Ajaxification.
Does the user need any special tools to use an Ajax-enabled web site?
Not really. As long as the user has a relatively recent version of any of the top browsers they should be OK. The browser list includes Internet Explorer, Firefox, Safari and others. The heart of Ajax is a browser component called the XmlHttpObject; In Internet Explorer this component is implemented as an ActiveX component while other browsers have their own mostly-compatible implementation.
The XmlHttpObject is what you – the developer – use to send queries to the web server without forcing the user to reload the whole browser page. When the server responds to the request you use JavaScript to update part of the page, using the Document Object Model. It’s important to realize that each browser may have its own quirks when it comes to JavaScript and this is where Ajax development can be tricky.
Does the developer need any special tools to do Ajax development?
Like plain HTML development, you can use a simple text editor (like Notepad) or your favorite Integrated Development Environment (IDE). Ajax is mainly about using existing tools and technologies to achieve a specific user interaction experience; so it stands to reason that your existing tools should be fine. That said, lots of vendors and open source projects are jumping on the bandwagon and starting to provide Ajax-specific modules as add-ins.
Without getting into the whole range of tools available, one thing that is helpful for serious Ajax development is a usable JavaScript debugger.
A debugger allows you to step through code as it is being executed so you can figure out what is going on when things go wrong. For Firefox there is the Venkman debugger (http://www.mozilla.org/projects/venkman/) while there are a couple of options for Internet Explorer including the Microsoft Script Debugger and the Microsoft Script Editor (the latter ships with recent versions of Microsoft Office).
Where can I learn how to do Ajax development?
Well this web site is probably a good place to start. You might want to look at our video tutorial which covers Ajax development from the ground up. In the tutorial we look at the foundations of Ajax, and then go on to build a functional shopping cart using Ajax technologies.
You might also want to keep an eye on the Ajax Forum for discussion of Ajax-related issues.
I’m comfortable with server-side development (like PHP, Java, Ruby or ASP) but not really into JavaScript – can I do Ajax?
The good news is that a lot of server side frameworks are starting to provide Ajax toolkits that mean you can write less code and let the framework generate the JavaScript for you.
A good example of such a framework is the Ajax support in Ruby on Rails; the Rails framework provides some Ruby methods that will generate Ajax code for you, saving you the trouble of being a JavaScript expert.
The same goes for PHP and other server side languages. The best thing about this approach is that it means you can continue to work in whichever language you are most comfortable with.
The Rails Ajax tools are built on a number of existing open source JavaScript libraries; aside from providing you with some really cool special effects, these libraries also take care of a lot of the cross-browser issues that can arise in Ajax development.
Of course it still helps to understand how things work under the hood when it comes to debugging issues – and there are unfortunately always issues.
by: Richard Mischook – www.killersites.com, www.killerajax.com