AJAX Basic

AJAX基础

AJAX HOME
AJAX首页
AJAX Intro
AJAX简介
AJAX Request
AJAX请求
AJAX Example
AJAX实例
AJAX Browsers
AJAX浏览器
AJAX XMLHttpRequest
AJAX XMLHttpRequest对象
AJAX Server
AJAX服务器端
AJAX Server Script
AJAX服务器脚本

AJAX Advanced

AJAX高阶

AJAX Suggest
AJAX建议
AJAX Source
AJAX源码
AJAX Database
AJAX数据库
AJAX XML File
AJAX XML文件
AJAX ResponseXML
AJAX响应XML

AJAX Examples

AJAX范例

AJAX Examples
AJAX范例

AJAX - The Server-Side Script

AJAX-服务器端脚本

Previous Next

AJAX - The server-side ASP script

AJAX-服务器端ASP脚本

Now we are going to create the server-side script that displays the current time.

现在我们来创建服务器端脚本以显示当前时间。

The responseText property (explained in the previous chapter) will store the data returned from the server. Here we want to send back the current time.

responseText属性(前面章节介绍过)将储存从服务器端返回的数据。我们将发送返回的当前时间。

The code in "time.asp" looks like this:

“time.asp”代码如下:

<%
response.expires=-1
response.write(time)
%>

Note: The response.expires command sets how long time (in minutes) a page will be cached on a browser before it expires. If a user returns to the same page before it expires, the cached version is displayed. response.expires=-1 indicates that the page will never be cached.

备注:response.expires【响应过期】命令设置在浏览器超时期内过多长时间网页清除缓存。如果用户在超时前返回相同页面,缓存版本将被显示。response.expires=-1表明页面不会被清除缓存。


Run your first AJAX application

运行您的第一个AJAX程序

Try the AJAX application by typing some text in the "Name" input field below:

在“Name”输入框中输入一些文字以验证AJAX程序:

Name: Time:

The "Time" input field gets the server's time from "time.asp", without reloading the page!

在不用重载页面的情况下,“Time”字段将获得服务器端“time.asp”里的时间!


Previous Next

宏飞网络是你学习web开发、测试web程序实例、和培养职业技能的首选网站。我们提供例子也许有些简单,但对理解基本概念有帮助。

我们尽量避免在教程、参考及例子中出现错误,但不能保证所有的内容都是正确的。

你使用本网站时,我们默认你已经阅读并接受了我们的隐私政策。

Copyright 2003-2011宏飞网络 版权所有