Execute an XMLHttpRequest in the context of the host application.
Name | Type | Description |
---|---|---|
url | String | either the URI to request or an options object (as below) containing at least a url property; should be relative to the context path of the host application |
options | RequestProperties | a RequestProperties object (see below for properties list) |
1 2AP.require('request', function(request){ request({ url: '/connect-example', success: function(responseText){ alert(responseText); } }); });
An object containing the options of a Request.
Name | Type | Description |
---|---|---|
url | String | the URL to request from the host application, relative to the host's context path |
type | String | the HTTP method name; defaults to GET |
cache | Boolean | if the request should be cached; default is true |
data | String | the string entity body of the request; required if type is POST or PUT |
contentType | String | the content-type string value of the entity body, above; required when data is supplied |
responseType | String | the response type this request will return. It defaults to json , however, it must be set to text when requesting a resource that does not return JSON, such as diffs, files, or logs. |
headers | Object | an object containing headers to set; supported headers are Accept |
success | function | a callback function executed on a 200 success status code |
error | function | a callback function executed when a HTTP status error code is returned |
Rate this page: