Martin Heller
Contributing Writer

AJAX 101

analysis
Jan 3, 20072 mins

In all the discussion of the difficulty of AJAX, the relative merits of the various free and commercial AJAX libraries, the AJAX support in control packages, and the AJAX support built into or added onto Web server technologies like Ruby on Rails and ASP.NET, it's easy to forget that AJAX is essentially a fairly simple idea. When you strip it down, AJAX is a way of using JavaScript, CSS,

In all the discussion of the difficulty of AJAX, the relative merits of the various free and commercial AJAX libraries, the AJAX support in control packages, and the AJAX support built into or added onto Web server technologies like Ruby on Rails and ASP.NET, it’s easy to forget that AJAX is essentially a fairly simple idea. When you strip it down, AJAX is a way of using JavaScript, CSS, the browser DOM, and the Microsoft XMLHTTP interface to make asynchronous calls to the server to update selected data.

Here’s some sample code in JavaScript, which Microsoft provided years ago to illustrate how to use XMLHTTP:

var xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlHttpReq.open("GET", "http://localhost/books.xml", false);
xmlHttpReq.send();
WScript.Echo(xmlHttpReq.responseText);

How hard is that?

Yes, yes, I know that the object is now called "Microsoft.XMLHTTP", and that the last line of the sample is code for the Windows Scripting host, and won’t run on a Web site. Instead, you would use dynamic HTML to update a region on the page. You’d have a named DIV, and you’d set the DIV’s innerHTML element to the new content.

Again, how hard is that?

Now, is there more to it? Of course: I’m oversimplifying, or there wouldn’t be any good reason for all those AJAX libraries. The minute you try to make an AJAX application work on multiple browsers and/or multiple operating systems, you run into compatibility issues. You might want to use a different data format than XML. You might want to build additional layers on AJAX to implement special effects, like the ones in Gmail and Flickr that helped the AJAX technology take off. The list of what you might want to do is almost as long as the list of solutions.

But enough about what I think. What do you think?

Martin Heller

Martin Heller is a contributing writer at InfoWorld. Formerly a web and Windows programming consultant, he developed databases, software, and websites from his office in Andover, Massachusetts, from 1986 to 2010. From 2010 to August of 2012, Martin was vice president of technology and education at Alpha Software. From March 2013 to January 2014, he was chairman of Tubifi, maker of a cloud-based video editor, having previously served as CEO.

Martin is the author or co-author of nearly a dozen PC software packages and half a dozen Web applications. He is also the author of several books on Windows programming. As a consultant, Martin has worked with companies of all sizes to design, develop, improve, and/or debug Windows, web, and database applications, and has performed strategic business consulting for high-tech corporations ranging from tiny to Fortune 100 and from local to multinational.

Martin’s specialties include programming languages C++, Python, C#, JavaScript, and SQL, and databases PostgreSQL, MySQL, Microsoft SQL Server, Oracle Database, Google Cloud Spanner, CockroachDB, MongoDB, Cassandra, and Couchbase. He writes about software development, data management, analytics, AI, and machine learning, contributing technology analyses, explainers, how-to articles, and hands-on reviews of software development tools, data platforms, AI models, machine learning libraries, and much more.

More from this author