Ajax技术简单入门
2005-10-01 11:28
525 查看
随着Google公司推出的Gmail服务后,越来越多的人开始关注Ajax技术了,所谓Ajax(Asynchronous JavaScript and XML缩写)技术,就是指运用JavaScript和XML在不用刷新Web页的情况下与Web服务器通信的技术.
一般来说,使用Ajax技术主要有两个原因:一是fast;二是cool。
下面通过一个示例来说明Ajax的使用:
1.HTML代码
btn1用来调用Ajax代码(请求服务器并将返回信息填充到select1里)。
1 <select id="select1">< SPAN>select>
2 <input id="btn1" value="Fill Select" type="button" onclick="getOptions();">
2.JavaScript代码调用Ajax
1// Create the Request object (the AJAX wrapper)
2var request = new Request();
3// Change this to fit your environment
4var url = "http://localhost/ajax/";
5function getOptions()
6protected string result = string.Empty;
2private void Page_Load(object sender, System.EventArgs e)
3{
4 for (int i=0; i<10; i++)
5 {
6 result += i.ToString() + "|option " + i.ToString() + "~";
7 }
8 result = result.Substring(0, result.Length - 1); // to drop the last '~'
9}
更多Ajax
下载:源文件 项目测试
一般来说,使用Ajax技术主要有两个原因:一是fast;二是cool。
下面通过一个示例来说明Ajax的使用:
1.HTML代码
btn1用来调用Ajax代码(请求服务器并将返回信息填充到select1里)。
1 <select id="select1">< SPAN>select>
2 <input id="btn1" value="Fill Select" type="button" onclick="getOptions();">
2.JavaScript代码调用Ajax
1// Create the Request object (the AJAX wrapper)
2var request = new Request();
3// Change this to fit your environment
4var url = "http://localhost/ajax/";
5function getOptions()
6protected string result = string.Empty;
2private void Page_Load(object sender, System.EventArgs e)
3{
4 for (int i=0; i<10; i++)
5 {
6 result += i.ToString() + "|option " + i.ToString() + "~";
7 }
8 result = result.Substring(0, result.Length - 1); // to drop the last '~'
9}
更多Ajax
下载:源文件 项目测试
相关文章推荐
- AJAX开发技术在PHP开发中的简单应用技巧
- asp.net- ajax简单入门使用方法,通过一般处理程序ashx进行处理
- AJAX开发技术在PHP开发过程中的简单应用技巧
- AJAX技术简介及入门实例[收藏]
- AJAX技术简介及入门实例
- 织梦Ajax技术入门教程
- [转]献给初学 Ajax 的 PHPer --Ajax 技术及其简单应用
- Ajax技术简单案例
- 在jsp中运用ajax(简单入门)
- AJAX技术入门 第二节 XMLHttpRequest对象的使用
- 技术分析DWR让AJAX如此简单
- Ajax技术在Asp.net中的简单应用
- Ajax PHP简单入门教程代码
- 清华大学计算中心培训部-技术分享:JAVA入门:简单的Java程序
- 基于mvc三层架构和ajax技术实现最简单的文件上传
- Ajax一个简单入门程序(用户登录验证)
- Ajax并不是一种技术(Ajax入门好文章)
- Ajax入门和简单示例
- AJAX技术入门 第一节 走进AJAX
- 在jsp中运用ajax(简单入门)