Remote Scripting Advanced Tutorials---Remotely execute server scripts

Source: Internet
Author: User
Complex WEB applications call both client script and server script. Client scripts are often used to program the user interface of an application-for example, to dynamically change Web page text, react to user actions such as double-clicking, and perform client-facing tasks such as validation. Client scripts are executed locally in the browser, providing a vivid, responsive interface to the user.
In contrast, server scripts are used to program the last segment of an application. This often leads to access to a database or to the execution of intermediate-level business logic. Server scripts are also used to create a larger range of applications: that is, applications that can be accessed through many different types of browsers, each with different access capabilities.
However, client and server scripts are mutually exclusive. When a page is first requested, the server may run a server script and pass the page to the browser, and then the browser can run the client script. However, if the server script on the page is necessary to run again, the page must be submitted back to the server, and the server can effectively rerun the page. Maintenance of controls on the page and the values in the script may involve a complex scripting process of passing information back and forth between the browser and the server. In addition, the reentrant process between the client and the server involves displaying an overloaded procedure for an application.
A compromise is the remote scripting. Remote scripting allows users to work in client scripts, but to invoke methods (functions or routines) in an ASP page. In fact, users can invoke server scripts as they would call local routines, but they still run on the server and have all the access to the server's capabilities. Because the user never leaves the current page as the calling server script, the page state remains.
Users can use remote scripting in the following tasks:
Data checking and data validation on the server when the user continues to interact with a data entry form.
Update the information from the server's pages without refreshing the screen.
How Remote Scripting Works
Remote scripting is implemented as a library of functions that users call from client scripts when they want to run a server method. When a user invokes some kind of server method, the request is passed to an agent that runs asynchronously in the browser (the broker is implemented as a Java applet during the implementation process). The agent process sends a request to the server that contains the ASP page of the user invoke method.
The server loads the ASP page, and a special routine on the ASP page dispatches the user's request to the correct function. If the method has a return value, the value is sent back to the agent process, which wraps it as an object--a calling object--it contains the properties of the return value and other useful information.
When a user invokes a server method in a client script, you can choose one of two ways to do so:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.