For Adobe ColdFusion application servers How it works

Remote scripting is a typical client / server relationship. The client (the visible web page) requests information from the server, and the server responds by sending back packets of data. The client listens for the arrival of a data packet and uses the data however it likes. This is called a request-response transaction.

The key to remote scripting is an HTML inline frame or iframe embedded in the client page. The client page itself could be a plain page with no server language employed. The iframe contains another rudimentary page. While the browser window itself doesn't refresh, this iframe does refresh each time a transaction occurs. To improve the user experience, we hide the iframe from view. Here's what happens:

  1. The client page loads in the browser. The invisible iframe is built. A JavaScript object representing the remote scripting gateway is created. The gateway object knows the URL of the server page it needs to communicate with. (There could be several gateway objects on the page, each communicating with different URLs.)
  2. The visitor performs some action — perhaps she selects an item in a select box. This triggers an event (onchange or onclick perhaps).
  3. JavaScript associated with the event passes some data (perhaps the selected value) to the remote gateway object and (via the gateway) sends a request to the server. A particular with parameters passed in the query string is loaded into the hidden iframe.
  4. The server processes the parameters in the query string and formulates a response. It could be performing some computation or querying a database. The response may be a simple value such as "42" or "true" or it could be an array, query record set or some other data structure.
  5. The server writes some JavaScript containing its response in the the server page contained within the hidden iframe. When that page finishes loading, JavaScript associated with the page's onload event calls a "listener" function in the client web page and passes it the response as a parameter.
  6. The listener function in the client page takes the data and incorporates it into the web page somehow. The listener function is generally custom-written for the situation as it relates to the structure of the client web page.
Uniform Resource Locator
HyperText Markup Language
The coding language used to create hypertext documents for use on the World Wide Web.