Mastering Ajax Websites
An anonymous reader writes to tell us that IBM DeveloperWorks has an interesting article introducing the uninitiated to the world of Ajax. From the article: "Ajax, which consists of HTML, JavaScript technology, DHTML, and DOM, is an approach that helps you transform clunky Web interfaces into interactive Ajax applications. The author, an Ajax expert, demonstrates how these technologies work together. Ajax is more than just the latest fad -- it's your stepping stone to build better Web sites through efficient use of your time."
Instead of a complex hybrid why not a new language ? Half the opinions about Ajax is that it's not worth all the effort. Too complex.
What about Python or something new just for interfaces ? Something like Macromedia Flash ?
From the article:
... "Particular Way" for browser two ...
JavaScript code is the core code running Ajax applications and it helps facilitate communication with server applications.
Depending on JavaScript could be its downfall, since JavaScript has so many functional work-arounds for each browser. Even the article mentions (but dismisses) this problem.
From the article (again):
Microsoft's browser, Internet Explorer, uses the MSXML parser for handling XML (you can find out more about MSXML in Resources). So when you write Ajax applications that need to work on Internet Explorer, you need to create the object in a particular way.
"Particular Way" for browser one
Sounds like in an inherently poor design.
My only complaint about AJAX sites is it makes bookmarking something damn near impossible.
Your hair look like poop, Bob! - Wanker.
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 for a couple of minutes, then try using a map from MapQuest. 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.
Depending on JavaScript could be its downfall ... Sounds like in an inherently poor design.
While I'm not a big fan of JavaScript, the incompatibilities you talk about aren't JavaScript's fault. They are due to different levels of JavaScript support in different browsers, and the addition of non-standard features by the different browser camps. AFAIK, XMLHttpRequest is not a standard. It was invented by Microsoft, and others found it so useful that all modern browsers now support it, albeit with slightly different APIs. That is the source of the incompatibilities, not JavaScript.
I fail to see how anybody can be an "Expert" at something that is nothing more than a couple lines of code and a function or two. People seem to attribute "AJAX" to an entire javascript feature, when the part of the code that is actually "AJAX" is so small it's not worth mentioning. Not the mention the term AJAX seems overused and more complicated than it really is. It's basic javascript, nothing fancy or advanced or special.
There's way too much hype over such a small thing. It gets annoying.
google.slashdot
Bogtha Bogtha Bogtha
A growing annoyance is a page that hangs during loading because its advertising site is slow. With plain HTML, page rendering isn't delayed for image loading. With AJAX, page load can be stalled while the ad server cranks. I keep seeing "Waiting for servedby.advertising.net" in the browser status line. Fortunately, I can just close the page and go to a competitor.
I just bought 40 backup tapes. First site had some problem with its dynamic stuff. Went to another site and spent money there.
You do know that Microsoft actually invented the XMLHttpRequest object, don't you (they then completely ignored it for years until Google realized its potential)? And since COM/ActiveX is the main way things get done in the Microsoft world, it's entirely appropriate (although, you're right, the security implications are huge).
I will be really impressed if Microsoft really is changing their implementation to an in-browser object instead of a COM object, as it means that they will have changed something they invented to fit in with everyone else - the exact opposite of their usual behaviour.
I'm all for bashing M$ when they deserve it, but give them credit where it's due.
-- Dramatisation - May Not Have Happened
Look at what Google Maps did for online mapping and tell me AJAX is "just a fad".
Okay. The word "AJAX" is just a fad.
The actual implementation will not be, and sites that use "AJAX" will range from the finely crafted interfaces to the usability nightmares.
You can tell this is a fad because 1) this technique has been available for years this with Java applets, iframes and dynamic script src includes 2) it's not beneficial for 99% of the websites out there 3) it requires extra work to make the process intuitive to users 4) it's more costly to develop in that it takes longer and requires more smarts, and most of the time it isn't going to pay for itself, because simply getting rid of a page reload in the age of broadband doesn't itself improve the underlying quality of the website. The success of most websites still has 99% to do with content and 1% or less with UI aspects. Look at Craig's List or this website. The reason the technique has become popular all of the sudden is because Google has been incorperating it alot and someone gave it a name. Before the name AJAX came along you would have had to describe it with a sentance and that doesn't fit in a headline. Before HTTPRequest you could have as easily done an location.replace() to a CGI in a hidden frame and had the CGI's response do a callback to a function in the calling window and it would work exactly the same way. When you use the location.replace() method you avoid the clicking sound and the history entry when calling the hidden CGI. You can even use an iframe if you want to avoid using a frameset. This technique has been available since the 90's. I might still prefer this method because it's more robust and there's no need for compatability checking.
I've been working on a project that provides a web-based environment for people with a medical condition to get counseling and support online. Chat has been one of the desired features, but the various methods for implementing chat were presenting a problem. Java applets and Flash applications presented problems with time to load for modem users as well as issues with having the right versions of Java/Flash player installed on client. I thought setting up a Jabber server and letting folks use a client installed on their computer would be a good solution, but many (most) found it too difficult to install and configure a chat client. (These are older folks often with little computer experience.) AJAX came to the rescue. The "chat client" is part of the web application. It is as lightweight as the typical web pages being loaded. The exchange of messages between client and server require very little bandwidth. The chat application is just part of the same environment that the users are already comfortable using. I don't see AJAX as the answer to everything and, for the moment, having web applications chock full of AJAX doesn't make sense. But, it has come in very handy in the case of chat for the project I am working on.
Nope. Can't think of one. You do realise that it's perfectly reasonable to use Javascript with real links don't you? And I wasn't complaining about onclicks, I was complaining about spans and onclicks together being a half-arsed replacement for real links.
So basically I should stop wanting my basic browser features to work, even though other providers can do it, and even though it would work if they constructed their web application correctly?
Only if you mix up the controller with the view.
Bad example, for two reasons. Firstly, we're not just talking about bookmarking, as I've already explained. Secondly, the analogy doesn't hold because nobody even mentioned bookmarking individual paragraphs. People would complain if you couldn't open individual Word documents directly from your file system, from your recent document list, etc, instead being forced to open Word, then use Word to find and open documents. The document is the unit of addressability here - whether that's a Word document or an email.
Bogtha Bogtha Bogtha