Recent Posts


Nice Use of the AJAX


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

MacRumors has a live ticker of the WWDC Keynote going that makes a nice use of AJAX.

At prior Apple keynotes, MacRumors and others would update a web page as new slides at the Keynote went by. With no live video or audio feed, this was all the information junkies had. The internet at large would come to this page and read over the list of features, and then refresh the page until something new showed up. This would quickly kill the web servers, and no one could find out what they were supposed to buy.

Then, the baby jesus would cry.

This year MacRumors is using an AJAX call to insert the new chunks of information into the page at regular one minute intervals. From a developer/publisher standpoint, this is good because

  1. You throttle the requests to your webserver. Sure, a user could still refresh the page more than once a minute, but few are likely to do so when they know that new information is just a minute away
  2. When the information is sent back to the end user, it’s a small bit of XML that contains only the updated items. Instead of sending back a 30kb page each time, you send back a 2kb XML file. You also avoid having to resend any assets (images, CSS files, Javascript files) that refreshing the main page might trigger. This is a huge advantage when you’re trying to build something that’s going to scale.

Both of these make for a much happier server, which makes for a much happier user experience. There’s more info on the solution at the MacRumors site itself.

Originally published August 7, 2006

Copyright © Alan Storm 1975 – 2021 All Rights Reserved

Originally Posted: 7th August 2006