Constructor
new Ajax(config)
Parameters:
| Name | Type | Description |
|---|---|---|
config |
object | 自定义配置项 |
Properties:
| Name | Type | Description |
|---|---|---|
extend |
string | Rsd.common.Object |
xtype |
string | ajax |
events |
EventList | 事件列表 |
method |
string | GET,POST,PUT,DELETE |
url |
string | |
contentType |
string | application/x-www-form-urlencoded; charset=UTF-8 |
dataType |
string | text,json |
async |
boolean | false |
username |
string | |
password |
string | |
appId |
string | |
token |
string | |
authCode |
string |
- Source:
Methods
(static) complete()
- Source:
(static) error(xhr, error)
Parameters:
| Name | Type | Description |
|---|---|---|
xhr |
XmlHttpRequest | |
error |
string |
- Source:
(static) getAjaxConfig()
获取当前ajax的配置项
- Source:
(static) on()
事件注册
- Source:
(static) request(data, callback)
http请求,返回json结构数据
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | 作为Ajax对象请求时的参数中data属性(即远程方法的参数) |
callback |
string | function | 回调函数,callback方法和对象success方法只有一个有效,优先使用callback。callback需求每次请求时指定,success对象属于,不需要每次请求指定 |
- Source:
(static) success()
请求成功(status == 200) 处理方法,仅在 request方法未指定callback参数时有效
- Source: