Home > Web Front-end > HTML Tutorial > About page partial refresh routine_html/css_WEB-ITnose

About page partial refresh routine_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:04:45
Original
1050 people have browsed it


A specific example of RS technology
In the previous post, I introduced the basic working principle of RS. Obviously, if RS technology is applied to the design of a
website, it will have many extraordinary effects ( Especially its biggest advantage is that it can call the server-side code without refreshing the
page). It is precisely because of this feature that you can process the data in the database just like writing a
traditional C/S mode program (I think everyone must want to know how to implement it, below. To give a specific example, debugging this broken program almost exhausted me, haha)
As you can see from the previous description, to use RS technology, the client and server need to meet the following two conditions:
1. The client only needs to support Java applet
2. The server only needs to support ASP
In other words, RS technology is completely independent of the browser (of course the browser needs to at least support Java
and JavaScript). You can use it in IE, too. It can be completely used in
NC, which is also a significant feature that distinguishes it from RDS technology.
Before being able to use RS technology flexibly, we must first explain an issue, which is the issue of "asynchronous call"
that was mentioned before. It is precisely because of the asynchronous call that you can only refresh a certain part of the page without refreshing
the entire page.
Due to this feature, you can let the server
check the validity of the data you input while you are browsing the page (of course this can be a series of very complex legality checks, for example,
Compare the data entered by the user with the existing data in the database, etc. This cannot be solved by the client's JS)
Then when the server returns the check result, you can perform the corresponding operation (such as popping up a The dialog box tells the user
Input errors, etc.)
The syntax for asynchronous calls is as follows:
RSExecute(serverURL, functionname, param_list)
The first parameter is the complete asp page you want to call URL path
The second parameter is the name of the function you want to call
The following are the input parameters required by the function
If the function you want to call requires two input parameters, it is written like this:
RSExecute(serverURL, functionname, f_arg_1, f_arg_2)
There are two ways to write when calling,
One is to return a result:
objResult = RSExecute(serverURL, functionname, f_arg_1 , f_arg_2);
The other is a calling method that does not return a result:
RSExecute(url, func_name, f_arg_1, f_arg_2, CallbackFunction);
Special attention should be paid to this calling method. It is a JS function on the client
. It means that once RS completes the call on the server, it will call this function immediately and return the result to this
function.
A typical CallbackFunction function should have the following structure:
function CallbackFunction(objResult) {
//Your own processing
}
The only input parameter objResult is called by RS Return value.
Let’s assume a situation like this:
The user enters the user’s e-mail address in the browser, and then the user leaves the e-mail address input box
and enters the next input process , this time it is time for RS to come into play. It queries the address in the database of the
server based on the address entered by the user, and then determines whether the user already exists, and then
returns the result to the client. The client then uses DHTML technology to prompt the user for the information previously entered in an input box called "ShowResult"
.
function CallbackFunc(objResult) {
// Prompt user information
window[objResult.context].value = objResult.return_value;
}
And RSExecute() should be called like this
RSExecute(serverURL, functionname, f_arg_1, CallbackFunc, "ShowResult");
No more, no more, the above is so long-winded, I think everyone is confused, so the following is
Let the specific code speak for itself:
(Please create a system DSN file called NW on your server before using the code. This file uses
Northworld, the sample database that comes with Chinese ACCESS97)
The following example works like this. default.htm is divided into two frames. RS technology is used in the
main.html page. You can notice that submit
is not used in main.html. So if If you hit the Enter key directly on this page, nothing will appear. You must click the
"Get Information" button with the mouse to use this partial page refresh technology. After clicking the button, there will be
a small delay on the page (during this time the java applet establishes a connection with the server in the background)
Then the page will return to the normal mouse immediately, and you can continue to perform other operations on the page.
Instead of having to wait for data like when a normal page is refreshed.
Everyone can understand info.asp at a glance. It is actually a very simple program for processing strings.
If you are familiar with DHTML technology, you can complete these operations on the client.
As for EmpData.asp, it is the program for processing data on the server side.
Well, you can experience the benefits yourself
.

Be especially careful not to change too much code, otherwise it is easy to make mistakes. After all, you are programming in JavaScript.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template