I like the term JavaScript components because it implies that there are all these components that eventually will come together in a functional way. In the past DHTML typically would load huge JavaScript files that tended to cover all the possibilities in one go, even if all those possibilities were not used by someone viewing the page: A kind of shotgun approach if you will.

But via the use of xmlhttprequest we can change that around and load only what is needed for minimal functionality and then load the rest when a user requests a particular site feature. Not only can this dramatically decrease page file sizes, but it also gets around the one connection per script tag problem.

Let us dive into it by first looking at an example:

View Example