易截截图软件、单文件、免安装、纯绿色、仅160KB

Ajax 的状态介绍

在《Pragmatic Ajax A Web 2.0 Primer 》中偶然看到对readyStae状态的介绍,感觉这个介绍很实在,摘译如下:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire response received.
3: (Interactive) the response is being parsed.
4: (Completed) the response has been parsed, is ready for harvesting.
0 - (未初始化)还没有调用send()方法
1 - (载入)已调用send()方法,正在发送请求
2 - (载入完成)send()方法执行完成,已经接收到全部响应内容
3 - (交互)正在解析响应内容
4 - (完成)响应内容解析完成,可以在客户端调用了
对于readyState的这五种状态,其他书中大都语焉不详。像《Foundations of Ajax》中,只在书中的表2-2简单地列举了状态的“名称”--The state of the request. The five possible values are 0 = uninitialized, 1 = loading, 2 = loaded, 3 = interactive, and 4 = complete。而《Ajax in Action》中似乎根本就没有提到这5种状态的细节。
《Professional Ajax》中虽不尽人意,但还是有可取之处:
There are five possible values for readyState:
0 (Uninitialized): The object has been created but the open() method hasn’t been called.
1 (Loading): The open() method has been called but the request hasn’t been sent.
2 (Loaded): The request has been sent.
3 (Interactive). A partial response has been received.
4 (Complete): All data has been received and the connection has been closed.
readyState有五种可能的值:
0 (未初始化): (XMLHttpRequest)对象已经创建,但还没有调用open()方法。
1 (载入):已经调用open() 方法,但尚未发送请求。
2 (载入完成): 请求已经发送完成。
3 (交互):可以接收到部分响应数据。
4 (完成):已经接收到了全部数据,并且连接已经关闭。
在《Understanding AJAX: Using JavaScript to Create Rich Internet Applications》中,则用下表进行了说明:
readyState Status Code
Status of the XMLHttpRequest Object
(0) UNINITIALIZED 未初始化
The object has been created but not initialized. (The open method has not been called.)


相关文档:

关于struts2中ajax标签的一点学习笔记

其实ajax的东西不是很熟悉,而且对于javascript这样零碎的语言实在是很抗拒。于是过去一直都逃避它,迫于项目的压力,不得已惟有硬碰硬了。为了快速上手,之前做了几个小实验,代码实在太多了。幸好struts2提供了一些ajax的简易实现。
跟网上所有的教程一样,先从最简单的开始吧~
在头结点加上<s:head theme="ajax"/&g ......

AJAX判断用户名是否被注册

用的标签有ScriptManager,UpdatePanel,UpdateProgress ,主要的是UpdatePanel中的Triggers属性一定要对。
前台代码
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateP ......

jQuery Ajax缓存问题

在使用jQuery 的Ajax加载数据是 如果使用get方式传递参数则存在一下问题
firefox下传递数据正常
ie下则会出现缓存问题
解决方法:
1、http://yourwebsite?parseInt(Math.random() * 1000) 在url后面加上一个随即数,这样每次发送的就不一样了,而且不影响你的功能.
2、使用post传递参数
......

AJAX里TabContainer的CSS (转贴)

AJAX自从引进了Tab,着实让我开心了一番。但是,在调整Tab的样式的时候,也着实让我吃了一惊。
于是,抱着没有困难也要制造困难的原则,开始了征途:
按照Tab作者Ronald Buckton所说,Tab的CSS包含如下几个类:
(1).ajax__tab_header: A container element that wraps all of the tabs at the top of the TabContainer. ......

Ajax的post方法的使用

刚开始学Ajax,看到很多网上的代码都用Get方法提交参数,Tomcat默认ISO编码实在是让人头痛,对付乱码我都是用过滤器做字符编码过滤的,Get方法过滤器监听不到,所以我一直喜欢使用Post方法,下面对Ajax Get和Post方法做一对比
GET:
view plaincopy to clipboardprint?
<mce:script type="text/javascript"><!- ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号