JavaScript Remote Scripting: Reading Data From the Server
(Page 1 of 5 )
Client-server interaction achieved without involving page reloads has become very popular for Web services. This can be handled in a variety of ways. This article covers several of them, starting with Asynchronous JavaScript and XML (AJAX).
Introduction
With the rapid introduction of JavaScript-based http requests into Web programs, one of the most common activities during the development cycle for a client-side application involves writing code to perform some kind of silent interaction between the browser and the server.
Although it's rather premature to evaluate the real impact of all these backend processes within existing and future applications, the truth is that client-server communication without page reloads has become extremely popular for implementing a great variety of Web services. Whether you're planning to develop an auto-completion system, a simple news rotator or a full-fledged mechanism to pull out database records in the background, JavaScript-based http requests can make the overall development process much faster and more pleasant.
The thing about silent client-server interaction, though, is that it can be performed through several methods categorized under the generic title of remote scripting. Of course, if you're in touch with modern Web programming, probably the first approximation that comes to your mind is AJAX (Asynchronous JavaScript and XML), which uses native XMLHttpRequest objects -- or an ActiveX Control in the case of Internet Explorer -- for dynamic file requesting.
However, the list doesn't end there. With very little knowledge about some DOM methods, it's possible to make true http requests on the fly, all without putting a single hand into AJAX technology. As I said right at the beginning of this article, background client-server interaction has turned quickly into a popular feature within Web applications, so it's worth taking a look at some of these approaches for making requests on the fly.
Over this series of tutorials, I'll be attempting to build some JavaScript applications, in order to illustrate different approaches to pulling out server data, ranging from the already traditional AJAX technique to W3C DOM standard-compliant methods. The end result of this experience will be a set of easy-to-customize JavaScript programs, useful to include in your own applications with only minor hassles.
Let's get going!
Next: A non-standard approximation: reading server data with AJAX >>
More JavaScript Articles
More By Alejandro Gervasio