AJAX Programming – Best Practices

Oh boy, have I been waiting and waiting for a chance to talk about AJAX programming. This is a technology that’s been around for a while now, and it’s very important if for no other reason than its basically making SaaS viable and lively, and also making the web service model as a whole more than just a jerky, static query system impossible to make into a rich experience.

What AJAX Is:

AJAX programming is the use of JavaScript and XML to create programmable, software-like behavior using HTML elements in stead of traditional controls and library assets as is the case in actual compiled software.

JavaScript, of course, has been around for a very long time, and while it did add some liveliness to web interfaces on its own, it wasn’t until the XML implementation to itemize the page’s components, that it really saw its full potential.

Now, with this live, GUI-like frontend to back server-powered web systems running PHP, ASP and database systems, the internet is a streaming portal for internet media, gaming, software and cloud computing that couldn’t be, without AJAX. Yeah, HTML5 is stealing some of its thunder, but guess what? They’re the same thing, so actually it’s not!

Bad Ideas Being Used:

There are a number of poor uses of AJAX, many of which either waste computing power and bandwidth, or genuinely annoy users. The biggest abuse of AJAX is the pop up system it brings, which is an alternative to traditional “real” pop ups. These are a layer within the page which can obscure the entire page or block it from being clickable, until it gets what it wants.

Sure, this can be useful in GUI use for SaaS and web services, but it’s often used to force interstitial ads on people and trick them into clicking on what, due to clever positioning and scaling, is really the video player or image link they were after, when that was underneath it the whole time.

Using it to force floating link boxes full of social network buttons or chat windows is another bad practice that needs to stop.

Good Ideas and Best Practices:

Above all else, since AJAX and HTML5 are the backbone of the web working in a multimedia way for mobile devices (flash and classic java work questionably), you better make sure you’re completely W3C compliant in your implementation, no matter how pointless some bits of this may seem.

You also need to be very delicate in how many actively running, looped scripts you put in a page that auto redraws or auto loads new information. Browsers will freak out if more than a few of these are running. This happens a lot.

Now you know why lively pages crash from sitting idle, and cause Chrome to make you laugh at its off collar error messages!


Things to be wary of with this include being sloppy with CSS files. Make sure that you don’t have several that are redundant, and being called by different JavaScript or XML blocks. Condense them, because this can cause all manner of conflicts and management problems.

Don’t try to use this for web games, and only use it to play video for mobile devices, as PCs are still better suited by Flash for this.

Well, AJAX programming, beyond this, is all about technical stuff, and that’s well documented on the W3C schools website itself, so there’s no need for me to get into that part here! You’re ready to star t learning the coding itself, now that I’ve preemptively broken you of bad habits and enforced good practices in logic.

