new AjaxResponse(response)
This object provides a public API for AJAX Reponses. It should be instantiated with every new AJAX response inside of Viewer Control.
Parameters:
Name |
Type |
Description |
response |
Object |
Properties
Name |
Type |
Attributes |
Description |
headers |
Object |
|
|
status |
Number |
|
|
statusText |
String |
|
|
responseText |
String |
|
|
responseBody |
Array |
<optional>
|
Used by IE9-10 for content encryption. https://msdn.microsoft.com/en-us/library/ms534368(v=vs.85).aspx
|
|
Properties:
Name |
Type |
Description |
status |
Number |
|
statusText |
String |
|
responseText |
String |
|
responseBody |
Array |
|
Methods
Gets the value of a header
Parameters:
Name |
Type |
Description |
header |
String |
|
Returns:
- Type
- String
Example
// Get the header with a case-insensitive argument
var response = new PCCViewer.AjaxResponse({
headers: { 'Content-Type': 'application/json', 'X-Powered-By': 'Express' },
status: 200,
statusText: 'OK',
responseText: 'Success!'
});
response.getResponseHeader('Content-Type'); // returns 'application/json'
response.getResponseHeader('content-type'); // returns 'application/json'
response.getResponseHeader('CONTENT-TYPE'); // returns 'application/json'
Gets the value of a header
Parameters:
Name |
Type |
Description |
header |
String |
|
Returns:
- Type
- String
Example
// Get the header with a case-insensitive argument
var response = new PCCViewer.AjaxResponse({
headers: { 'Content-Type': 'application/json', 'X-Powered-By': 'Express' },
status: 200,
statusText: 'OK',
responseText: 'Success!'
});
response.getResponseHeader('Content-Type'); // returns 'application/json'
response.getResponseHeader('content-type'); // returns 'application/json'
response.getResponseHeader('CONTENT-TYPE'); // returns 'application/json'