Why AJAX matters
I’d love to develop a cool new Ajax application. Any suggestions? Maybe a web-based interactive live content publishing system. What do you think?
by Geoffreyerffoeg (729040) on Sunday December 11, @09:44PM (#14236129)
AJAX isn’t an end in itself; it’s just a tool. It’s like JavaScript. Back when the web was old, if you wanted to do data validation for a form (for example), you had to send the page to the server and wait for a new page as a response. When JavaScript became popular and well-enough supported, the webpage itself could check data before sending it to the server – although the checks couldn’t be that complicated. AJAX is similar; instead of limiting yourself to either using a new page or client-side data, AJAX lets you use JS to access server-side data.As a concrete example, play with Google Maps [google.com] for a couple of minutes, then try using a map from MapQuest [mapquest.com]. It will quickly start to annoy you that you can’t drag the map and that you have to click to a new page to move the map around. GMaps isn’t pure AJAX, admittdly, since it deals with picture data – it can just write the image tags to the page and move them around as you drag. But the side text and the map searches are AJAX – when you click search, you don’t open a new page with the search results. You can keep using the map; the client will turn your search into an XML request, Google will process it, and send the results back as XML – asynchronously.
For another example, I wrote this week a dead-simple chat program (because I needed a specific feature). It was simpler to write a web app instead of a real app, because the latter would require networking, windowing, and whatnot – the web interface made GUI easy and manual networking irrelevant. Without AJAX, I would need to have the page reload every second to check if there are new messages – very distracting. I had the system asynchronously check for messages in the background, and when one arrived, update just that part without refreshing the page.
AJAX is a tool to be used when necessary. Don’t freak out over it, but realize it’s there whenever you need to use a more application-like interface instead of a page-like interface.
Leave a Reply