Posted by on in iDevelop | 0 comments

What is AJAX? Its a buzzword? Its a fad? Yes and No. Its cool if you know what it is, its a fad if you don’t know what it is. Possibly there’s not a single web-designer or developer on internet who’s never heard of AJAX, & thats just about it. A lot of them have heard about it quite a lot & quite often but just a few know what it really is. Though the number of people aware of the meaning of AJAX is quite less, the number of people buzzing with the word, as if they are the know-it-alls on the subject of AJAX, is quite quite high.

So what is AJAX? It stands for Asynchronous JavaScript + XML. It isn’t anything new, its just standards compliant xHTML, CSS, Javascript and XML, or in common terms, its what we’ve known as DHTML all these years. But AJAX sounds cool, so its the buzzword. People who think AJAX is cool should read this eye-opener at Lastcraft by Marcus Baker.

The selling point is remote-scripting, using XMLHttp object for communicating with the server in real-time and passing/getting the data without refreshing the page. Now just because its possible everywhere doesn’t mean that its ideal everywhere.

As with every technology, you can’t use it everywhere for everything. But still you’ll find a lot of idiots using it in ways where its not even required. Some days back, I came across a web-developer. He told me how cool his CMS is. He had re-written a large part of it just to implement AJAX. Now if you would’ve heard what & how he’s implemented AJAX, you’d have pulled your hair out of your head. He said that earlier he had Javascript validating the data on the client side. But he removed that and implemented remote-scripting, so that when the user clicks the submit button, his data is sent to an ASP script on the server via XMLHttp. The ASP script validates the data and returns the results back to the client. If there’s any invalid data, the user is notified else the data is submitted to the form processing script which then puts it in the database, without any validation apparently. 😯 Now those of you who have enough sense to understand what’s going on don’t need me to explain what’s going on!!! But for the benefit of others, I’ll list out the points:

  • The user who would’ve got instant results of data-validation with Javascript, would now have to wait for the servers response, given the fact that the response times can be quite long because of heavy traffic on the information superhighway and the wait might turn out to be an endless one if the internet connection fails.
  • If the Javascript is disabled or XMLHttp is not available(if user is using an older browser), then there would be no data validation & perhaps the data wouldn’t be submitted to the server for processing as well.
  • As there’s no server-side validation of the data, someone with malicious intent can disable Javascript & then wreck havoc.

Now that guy came over the last 2 points very smartly. When I asked him why has he removed server side data validation? He said that he didn’t have any server-side validation, there’s no need as the data was being validated by the Javascript & is now being validated by the ASP. And what happens if the user has Javascript disabled? He looked at me in the way a genius looks at a newbie when he asks a silly question. He indignantly replied that the form would be un-usable, all fields greyed out, if Javascript is disabled, thus forcing the user to enable it. 😯 After these answers, I didn’t want to hear the answer had I asked about the case when XMLHttp wouldn’t be available & Javascript being enabled. Apparently he didn’t think that its possible that Javascript is available & XMLHttp is not. I was just livid, but this is not something new. I’ve come across so many people like him, I’ve even lost the count. What was the last number? 336? 728? 1092? I don’t remember!!! There’re a lot of idiots in this world, another one won’t make a difference!!

I’m not saying that AJAX or Javascript or DHTML is bad or evil. Its just that people should know where to use something, just because its cool doesn’t mean its ideal as well. A lot of developers say, Google uses it, so why can’t we? And I ask them, are they Google or its equivalent? Is Google the ultimate authority on what is to be used & what not on the web? C’mon guys, face it, the smart people at Google like to innovate, experiment with things, and most importantly, they don’t use something in such an absurd & ridiculous way. Look at GMail, look at Google Suggest, they are innovations, something that’s cool and ideal implementation of technology, they didn’t use it just because its the buzzword.

Google is a trend setter. What they do is copied & followed up by others, be it AdSense or Blogger or massive storage in GMail or the enhanced UI in GMail. I for one believe in setting trends for others to follow rather than in following in someone else’s footsteps. I’m not a sheep in the herd.