| You are here: | About>Computing & Technology>Web Design / HTML> About.com Web Design A to Z> Books> About Web Design Book> AWD: Chapter 14> When to Use Ajax and When Not To Use Ajax |
![]() | Web Design / HTML |
More Ajax ResourcesWhen to Use Ajax and When Not ToWhat to Do When You Get the "Ajax Call" from Your BossI admit it, I've never been a huge fan of JavaScript. I was always really glad that About had a JavaScript Guide so that I didn't have to cover it on my site. I can read and write JavaScript, but until lately, I had very little interest in it. For whatever reason, my mind had a complete mental break when it came to writing JS scripts. I can write complicated C++ and Java applications and I can write Perl CGI scripts in my sleep, but JavaScript was always a struggle. Ajax Made JavaScript More FunI think part of the reason I didn't like JavaScript was because rollovers are boring. Sure, you can do more than that with JS, but 90% of the sites out there using it were doing either rollovers or form validation, and not much else. And once you've validated one form, you've validated them all. Then Ajax came along and made it all new again. Suddenly we had browsers that would support JavaScript doing something other than swaping images and we had XML and the DOM to connect data to our scripts. And all of this means that Ajax is intersting to me, so I want to build Ajax applications. What's the Stupidest Ajax Application You've Ever Built?I think mine would have to be the email checker on an account that got almost no email. You would go to the Web page and it would say "You have 0 mail messages." The 0 would change if a message came in, but since that account got no mail, it would never change. I tested it by sending mail to the account, and it worked. But it was absolutely pointless. There were better mail checkers available five years ago, and I didn't have to have Firefox or IE running to use them. When one of my co-workers saw it she said "What's it do?" When I explained, she asked "Why?" Before Building an Ajax Application Always Ask WhyWhy Ajax? Why Not Something Else? This seemed like a good use of Ajax, until you start thinking of some of the issues with it:
The thing that was interesting, is that this Web site had similar pages in the past that didn't use Ajax. They delivered the content either with hidden divs or separate HTML pages. There was no reason to use Ajax other than that Ajax was cool, and our boss had suggested we look for places to use it. Ajax is for Action Not ContentIf you're going to put up an Ajax application, or just something Ajax-like on your Web site, first determine if the data you're accessing changes. The point of the asynchronous request is that it makes requests to the server for information that has changed faster - because it's happening while the reader is doing something else. Then when they click a link or button (or after a set amount of time - whatever your distinction is) the data shows up right away. If your content or data never changes, then you shouldn't use Ajax to access it. If your content or data only rarely changes, then you probably shouldn't use Ajax to access it. Page 2: Things that are good for Ajax, and what to do when you get the call. More Ajax Resources |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


