Use JavaScript implementation page without refreshing update data

xiaoxiao2021-03-31  218

A situation will often encounter in the programming, which is not known in advance which data will require it, and must feed back the data after re-extracting the data from the server after selecting the data. For example, when the user chooses the province, we will immediately re-display all the provinces in the city. This situation generally needs to refresh the entire page before you can read it, but this is not only less efficient, but also is not very elegant. In fact, use JavaScript to combine micro-software XMLHTTP objects, we can read data from the server without refreshing, "slightly" can read data from the server, which is both professional and efficient.

Below we demonstrate this technology with a case where the user is registered.

1. First create a checkuser.asp file on the server to detect if the user exists, depending on whether the user has separate feedback 0 and 1

U_NAME = Request.QueryString ("u_name")

IF u_name exists the THEN

Response.write "0"

Else

Response.write "1"

END IF

2. Client HTML Design:

First, JavaScript code