Ext框架学习 (三) Ext.Ajax类

 

Class Ext.Ajax

包:

Ext

定义于:

Connection.js

类:

Ajax

基类:

Connection

全局ajax请求类。提供一个简单的方式提交ajax请求,有很大的弹性。用法实例:

Global Ajax request class. Provides a simple way to make Ajax requests with maximum flexibility. Example usage:

// Basic request

//基本请求

Ext.Ajax.request({

   url: 'foo.php',

   success: someFn,

  failure: otherFn,

   headers: {

       'my-header': 'foo'

   },

   params: { foo: 'bar' }

});

// Simple ajax form submission

Ext.Ajax.request({

    form: 'some-form',

    params: 'foo=bar'

});

// Default headers to pass in every request

//每次请求默认的headers

Ext.Ajax.defaultHeaders = {

    'Powered-By': 'Ext'

};

// Global Ajax events can be handled on every request!

//全局 ajax事件,在每次请求时被处理。

Ext.Ajax.on('beforerequest', this.showSpinner, this);



This class is a singleton and cannot be created directly.

这个类是单立的,不能被直接创建。

Config Options

配置选项:

Config Options

Defined By

 

listeners : Object

A config object containing one or more event handlers to be added to this object during initialization. This should b...

包含一个或多个事件处理器的配置对象,在对象初始化时添加 example for attaching multiple handlers at once.

Observable

Public Properties

公共方法

Property

Defined By

定义在

 

autoAbort : Boolean

Whether a new request should abort any pending requests. (defaults to false)

这个值决定一个未决(pending)请求是否被终止。默认为false.

Ajax

 

defaultHeaders : Object

An object containing request headers which are added to each request made by this object. (defaults to undefined)

包含请求标头的对象在每次请求时用这个对象来添加,默认为undefine.

Ajax

 

disableCaching : Boolean

True to add a unique cache-buster param to GET requests. (defaults to true)

为真是添加一个唯一的cache-buster参数到get访问中。

Ajax

 

extraParams : Object

An object containing properties which are used as extra parameters to each request made by this object. (defaults to...

这个对象为每次请求添加额外的参数。

Ajax

 

method : String

The default HTTP method to be used for requests. Note that this is case-sensitive and should be all caps (defaults ...

默认请求的http方法。注意,它是case-sensitive的,应该all caps.(不懂这两个词的意思。)

Ajax

 

timeout : Number

The timeout in milliseconds to be used for requests. (defaults to 30000)
请求过期的时间(毫秒),默认为30000

Ajax

 

url : String

The default URL to be used for requests to the server. (defaults to undefined)

要访问的url

Ajax

Public Methods

公共方法

Method

定义

abort[Number transactionId] ) : void

Aborts any outstanding request.

终止任何停止的请求。

Parameters:

Returns:

Connection

 

addEvents( Object object ) : void

Used to define events on this Observable

中定义一个事件

Parameters:

Returns:

Observable

 

addListener( String eventName, Function handler, [Object scope], [Object options] ) : void

Appends an event handler to this component

为这个组件附加一个事件处理器

Parameters:

上下文。

上下文。

delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.

single: true,

delay: 100,

forumId: 4

fn:

scope:

delay: 100

},

fn:

scope:

},

fn:

scope:

}

scope:

Returns:

Observable

posted @ 2008-03-31 15:48  GodSpeed  阅读(10939)  评论(1编辑  收藏  举报