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:
- The visitor performs some action — perhaps she selects an item in a select box. This triggers an event (
- 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.
onloadevent calls a "listener" function in the client web page and passes it the response as a parameter.
- 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.