ExtJS之Ext.Ajax.request用法详解
来源:互联网 发布:一次性洗脸巾危害 知乎 编辑:程序博客网 时间:2024/05/16 10:34
在Ext开发过程中,基本上时刻需要用到异步请求,那么这个请求到底是怎么执行的呢,我们接下来来探讨下
首先:Ext.Ajax类继承了Ext.data.Connection,为Ajax的请求提供了最大灵活性的操作方式
再简单请求基础上我们加上一个使用的
Ext.Ajax.request({
url : this.url,
params : {operFlag:"...",id: id},
success : function(resp,opts) {
var respText = Ext.util.JSON.decode(resp.responseText);
if(respText.msg == null){
Ext.MessageBox.alert('提示', '操作成功!');
}else{
Ext.MessageBox.alert('提示',respText.msg);
}
},
failure : function(){
this.tree.body.unmask();
Ext.MessageBox.alert('提示', '操作失败!');
},
scope : this
});
后台代码:json = "{success: false,msg:'无法操作'}";
说明的是这种请求通常都是放在触发某个事件的处理方法中的
url:就是我们要请求的路径
params:里面的参数用逗号隔开,就是我们要发出请求带的参数
success:是服务器处理成功返回
failure:是服务器处理失败返回
重点讲的就是如何处理返回值信息,我们的resp这个参数就显得非常重要了
status.200
statusText.OK
getResponseHeader.[object Object]
getAllResponseHeaders.Server: Apache-Coyote/1.1
Content-Type: text/html;charset=GBK
Content-Language: zh-CN
Content-Length: 108
Date: Wed, 31 Oct 2007 12:51:23 GMT
responseText.
<html>
<head>
<title>错误</title>
</head>
<body>
<h1>错误:this is a test!</h1>
</body>
</html>
argument.undefined
- options : Object>请求所调用的参数。The parameter to the request call.
- success : Boolean请求成功则为true。True if the request succeeded.
- response : Object包含了返回数据的xhr对象。The XMLHttpRequest object containing the response data. See http://www.w3.org/TR/XMLHttpRequest/ for details about accessing elements of the response.
- response : Object包含数据的xhr对象。The XMLHttpRequest object containing the response data.
- options : Object请求所调用的参数。The parameter to the request call.
- response : Object包含数据的xhr对象。 The XMLHttpRequest object containing the response data.
- options : Object请求所调用的参数。 The parameter to the request call.
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法详解
- ExtJS之Ext.Ajax.request用法待分析
- Ext.Ajax.request用法详解
- ExtJs中Ext.Ajax.request()跟getForm().submit()得用法
- extjs 使用Ext.Ajax.request进行数据传输
- ExtJS -- Ext.Ajax.request 返回结果判断
- extjs异步刷新技术Ext.Ajax.request
- Ext.Ajax.request的简单用法
- Ext.Ajax.request 用法参数介绍
- ExtJS中Ext.Ajax.request与form1.getForm().submit
- ExtJs Ext.Ajax.request提交实现waitMsg效果
- 程序的加载和链接机制
- 马士兵J2SE-第五章-数组
- 假设字符串类似这样的aba和aab就相等,现在随便给你二组字符串,请编程比较他们看是否相等
- 生产者消费者模型-python-多进程
- 百度笔试题系列之一-2011年9月24日百度笔试RD-1
- ExtJS之Ext.Ajax.request用法详解
- Android开发 下载显示进度
- (14)使用查询表达式的LINQ
- u突然放毒药
- Ubuntu下的deb包制作详解
- [C]calloc() 和malloc() 有什么区别?
- Eclipse安装插件长时间停留在calculating requirements and dependencies
- 就回来了
- SQL SERVER DBA 三十問