Weird Thoughts From Eric's Head

Tags - 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


It's definitely not hype. I'm working on my first AJAX app right now, and I'm really excited by what I'm able to do with it. There's a new(ish) article linked from the front page of java.sun.com which provides a good jump-start -- although be warned that there are a lot of errors in the code.
Excellent summary Eric, I didn't know what it was until I read this.
Great Blog Eric. Very well written, and even I understood it. It almost tempts me to become a Web Developer.
Hi eric One quesiton arised When you do a post usign AJAX since it is asynchronous what happens to the web page which made the request? DOes it hang , does the windows sign in IE rotate ??? I mean how does the user come to know that some activity is going on. this is when for example after posting the request and the server while processing it crashes. What will happen at the browser? And how do you handle this?? I have also posted in javaranch.
Niki,
my new articles I am going to post today an tomorrow is going to answer these questions hopefully.

Marilyn,
How hard is it to implement:
It is two JavaScript functions and a server side page to handle the request. Not that much work and I will show a basic example on Firday.

Would it be worth while if you only need to use it once in a project?
I would say yes. With the topic I am going to post today I discuss that using it too much many be bad. The tricky part is trying to figure out how to implement it your first time. After that you will be able to use it on multiple projects!

Eric
How much effort is required to implement AJAX? Would it be worthwhile if you only need to use it once in a project?
Marilyn ,
See the apply comment above!

Eric
ASP.NET 2.0 (Beta) has implemented this in the form of callbacks.
Ever heard of ATLAS. (Microsoft's answer to AJAX)
Microsoft is the one that started to use the XMLHttpRequest Object a long time ago. Atlas is talking about ASP.NET 2.0. You can read about it here: http://weblogs.asp.net/scottgu/archive/2005/06/28/416185.aspx
Eric
Good article. Relating to the buzz around Ajax features like "Google Suggest", we recently created a free web service that allows the addition of this new "live search" capability to any website without custom programming. We'd appreciate any feedback from users of the service.
I've been programming the web for the last ten years or more, and i've always done things like this from any platform. You can use frames, load images, or use Flash, Java applets, and so on. So, i believe AJAX is a very well made tool, but IMHO just another RAD technology... Best regards and keep up the good work! -LV
Ajax is nothing new (other than the name) and you can in fact do all of this with other browsers. It also has been around since IE 5 when MS introduced it. I used hidden iframes to update information on the server all of the time. The only thing that you get from the XMLHttpRequest object is confirmation of completion unlike iframes, frames, and pop up windows. Plus if you can code an applet and flash, more power to you. BUT my comment to those is with JavaScript I have no major loading time, applets and flash have a longer loading time. Plus as people say, the support for applets is getting smaller and the documentation is not that great IMHO.
Eric
Hello Eric:

> The only thing that you get from the XMLHttpRequest object is confirmation of completion unlike iframes, frames, and pop up windows.

Mmm, why so? I may be missing something, since i still have to look at the ASP.NET 2.0 implementation of the AJAX, but what about the onload event associated with all "loadable" objects? Also, a framed page can write back anything, scripts included, so that you have full control over the application logic. Well, at least in my own experience, i could always do what i needed.

Could you give any counter example?

Thanks for your attention. -LV

I am of the type 3 people listed above - I developed an app for Dow Jones (that never went to production because before it was done, bridge bought DJ, and shut our project down) that used the underlying technologies for AJAX to power a web-browser based offline trading system. I am surprised to see that it's taken people so long to jump on the bandwagon.
Ehr... and what about browsers that do NOT support javascript or where javascript is disabled? I think you're taking a bit of a shortcut if you telling to everyone just to use javascript for everything. I learned to use Javascript for some nice extra's and NOT to use it for core features since you can't trust it to work on every browser. Also the way it behaves can vary between browser versions without any notifications at all. So to mho: Use it in your intranet(where you can be shure about the browser and version being used) where it can be very helpfull and give you some great extra's. Just don't bother your vistors with strange behaviour;-) because there browser version is not perfectly up-to-date. Cheers, Wes
I don't see much use for ajax in a 'normal' website. But I think it's great for CMS-like pages. It's very useful for 'management-sites' where you have a lot of interaction with the server. Note that Ajax is nothing more than a name, which imho isn't chosen very well (for instance, you don't need to use XML, so Aja would be better). I don't think it's a hype, it's a step forward to new UI's & possibilitys on the web.

It seems that AJAX (Asynchronous Javascript And XML) has gained an extensive momentum since Jesse James Garrett from Adaptive...

Read more...



Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 10 + 9 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/pascarello/addTrackBack.action?entry=1119410289172