Weird Thoughts From Eric's Head

Categories : All | AJAX | BUSINESS | PERSONAL | PROGRAMMING | BOOK REVIEW

AJAX..Is It hype?
AJAX (Asynchronous Javascript And XML) seems to be a term that everyone is talking about. One person says it is hype, another person says it is the Holy Grail, and then you got the third person that says I have been using that for years. So is it hype? Is it new or old? What did people do before AJAX? Before I answer any of those, lets start from the point of having no clue about AJAX

What is AJAX and what can it do?
I have seen this question asked multiple times on the HTML and JavaScript forum here at http://www.JavaRanch.com and countless other forums. The simple answer is a programming concept that takes advantage of JavaScript’s XMLHttpRequest object to transfer information to and from the server without having to physically submit an entire page back to the server.

The cool thing about this is it works with JSP, ASP, .NET, PHP, etc. Are there any downfalls to note? Right off the bat, as always we need to rely on JavaScript. So for those users that are scared to death about JavaScript, since it is evil, they will not be able to handle this technology. Also, not all browsers handle the XMLHttpRequest Object. IE uses and ActiveX control and Mozilla followed IE (Yes they copied IE ~ surprised?) and implemented their own version of it. So that means wonderful cross browser code! So if your user is not using a current version of a browser, they will not be able to use this.

The second downfall is my favorite and why certain people call AJAX hype. That downfall is developer’s fear, ignorance, or hatred of JavaScript. I have been programming in JavaScript for over 10 years so I know it can be a pain. I have taught people how to program and I can still hear them banging their heads. People are afraid of this language since it has cross-browser differences. I wrote a book on JavaScript and I still have to sit there and bang my head when I forget which browser uses what for the width of the browser. It can be annoying, but grab a good reference and learn. Take a class, hire me (in the DC/Baltimore area), or buy a book!

Is this new? The term for AJAX is new but it has been around. IE implemented it years ago and no one seemed to use it. Then when the big names in the industry started to use it, people noticed its potential and went crazy. The way people jumped on this topic gave it the hype term, but over time I have seen so many applications utilizing the power of AJAX, that it is not hype and it is here to stay. Tell me that Google Maps, Google Suggest, GMAIL, or A9 is useless and is not user friendly.

With Ajax we can take a Web site’s user interface and turn it into a very rich client with responsiveness that reminds you of working with a desktop application. Yes we need to take into account network lag, but it is a lot quicker then rendering a page that has tons of images and HTML over and over again. For example, scroll the map on Google and scroll a map on MapQuest. Does that Network lag on Google compare to the post back and re-rendering of MapQuest? I will let you be the judge there.

The concept of avoiding post backs has been around for a long time. People have used this idea with hidden frames, iframes, and pop up windows for years. I have sent data back to the server through hidden iframes to keep people from being logged out of a web application. I have posted scores through an iframe for my JavaScript card games. I have seen pop ups used to transfer data to the server so the main page stays static so the user does not lose data. As you can see the concept has been there and we can improve.

The pop ups and frames have issues that the XMLHttpRequest object can address. My applications would freeze if there were 500 errors with pages. With the XMLHttpRequest Object, it is able to detect the 500 error and handle the situation. No more freezing.

In future articles I will discuss how to use the XMLHttpRequest Object, what are common mistakes I see, and what can we do to improve. So check back so you can learn more about AJAX and how it can help you create a Rich User Interface to improve your users experience.

As of right now, I am working with Dave Crane to produce AJAX In Action with Manning. That is the one main reason why my blog has been lacking material since I have been spending my free time creating content to give you the tools to unlock AJAX’s power. With the content in this book, we will give you the key to create the next AJAX application that everyone will be talking about! As it gets closer to publication I will talk more about the book.

Now please do not forget to check back and look for my next article on AJAX. If you have any questions about AJAX or JavaScript, add a comment here on my blog and I will make sure to answer it.



Eric Pascarello
Moderator of HTML/JavaScript at www.JavaRanch.com
Author of: JavaScript: Your Visual Blueprint for Dynamic Web Pages