To invoke a remote ASP script without refreshing the page
Source: Internet
Author: User
1. Please build a database in SQL Server name:house run the following script in house
if exists (select * from sysobjects where id = object_id (N ' [dbo].[ City] ') and OBJECTPROPERTY (ID, N ' isusertable ') = 1)
drop table [dbo]. [City]
Go
if exists (select * from sysobjects where id = object_id (N ' [dbo].[ Area] ') and OBJECTPROPERTY (ID, N ' isusertable ') = 1)
drop table [dbo]. [Area]
Go
CREATE TABLE [dbo]. [City] (
[ID] [int] IDENTITY (1, 1) not NULL,
[Name] [nvarchar] (Ten) NULL
) on [PRIMARY]
Go
CREATE TABLE [dbo]. [Area] (
[ID] [int] IDENTITY (1, 1) not NULL,
[Cityid] [INT] Null
[Name] [nvarchar] (a) NULL
) on [PRIMARY]
Go
INSERT into City (id,name) Values (1, "Guangzhou")
INSERT into City (id,name) Values (2, "Shanghai")
INSERT into City (id,name) Values (3, "Beijing")
INSERT into Area (id,cityid,name) Values (1, 1, "Tianhe")
INSERT into Area (id,cityid,name) Values (2,1, "white Clouds")
INSERT into Area (id,cityid,name) Values (3,2, "Hongkou")
INSERT into Area (id,cityid,name) Values (4,2, "Baoshan")
INSERT into Area (id,cityid,name) Values (5,2, "Jingan")
INSERT into Area (id,cityid,name) Values (6,3, "Haidian")
INSERT into Area (id,cityid,name) Values (7,3, "Chaoyang")
2. Establishment of documents
Create a file citydata.asp
<%@ Language=vbscript%>
<% RSDispatch%>
<script Runat=server language=javascript>
<!--#INCLUDE virtual= "/_scriptlibrary/rs. ASP "-->
<!--#INCLUDE virtual= "/jsconn.asp"-->
function Description ()
{
This. Getareaasarray = Dogetdata;
}
public_description = new description ();
function Dogetdata (Cityid)
{
var sql,rst,strtext,conn,i,j
conn = new ActiveXObject ("ADODB. Connection ");
Conn. ConnectionString = ConnStr;
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