JSDO properties, methods, and events reference : response property
  

response property

Returns an object or string containing data and status information from an operation invoked on a Data Object resource.
Note: As detailed here, you can inspect the object or string value of this property to return certain types of error information from a resource operation, depending on the operation, the error origination, and whether or not the resource supports before-imaging. As of Progress Data Objects 4.3 and later, the JSDO provides a getErrors( ) method that returns all types of error information for a specified table reference associated with a resource operation in a consistent manner, regardless of the operation, the error origination, and whether or not the resource supports before-imaging. For more information on this general error handling mechanism, see the getErrors( ) method description.
Data type: Object or string
Access: Read-only
Applies to: request object
If a resource's Create, Read, Update, Delete (CRUD), or Submit operation returns successfully and the response is valid JSON that can be converted to a JavaScript object, the response property contains a reference to the resource's data that is returned from the server. If the server response is not valid JSON, the response property is undefined.
If a resource's Invoke operation returns successfully and has no return value or output parameters, the property is null. If the Invoke operation has a return value, you can read it as the value of the object's _retVal property. If the operation has output parameters, you can read these parameters as the values of object properties whose case-sensitive names and data types match the names and data types of the output parameters specified for the operation on the server.
If any CUD or Submit operation returns an error for an OpenEdge resource, the response property error object always contains the following properties for a resource that does not support before-imaging and can contain these properties for a resource that supports before-imaging:
*_retVal — A string with the value of any ABL RETURN ERROR string or ReturnValue property for a thrown AppError object
*_errors — An array of JavaScript objects, each of which contains two properties: _errorMsg with the ABL error message string and _errorNum with the error number, for one of possibly many ABL-returned errors
Note: This response property object can also return an error object with _retVal and _errors properties for an unhandled application server exception instead of an ABL application error.
If a given OpenEdge resource does support before-imaging, and the response property does not reference an error object for an unsuccessful result, information for an individual record-change errors (from CUD or Submit operations) is typically returned as part of the before-image data for each record object associated with the error, which you can return using the getErrorString( ) method. For after* events of individual CUD operations, you can return this associated record object using the jsrecord property of the request object. In the callback for an afterSaveChanges event, or in any callback for a Promise object response to a Submit operation (saveChanges(true)) on a before-image resource, you can return the before-image data for every JSDO record object sent to the server using the jsrecords property of the request object.
If a CRUD operation returns an error on a Rollbase resource, the response property references a single string value (not an Object) with the error information.
Access to information on individual record-change error results depends on if the resource operation is a Create, Update, Delete (CUD), or a Submit operation and if the resource supports before-imaging. For more information, see the section on error handling in the description of the saveChanges( ) method. See also the notes in this description of the response property.
The response property is available only for the following JSDO events or in the request object returned to a jQuery Promise callback:
*afterCreate
*afterDelete
*afterFill
*afterInvoke
*afterSaveChanges
*afterUpdate
This request object property is also available for any session online and offline events that are fired in response to the associated resource operation when it encounters a change in the online status of the JSDO login session (JSDOSession or Session object). The request object is itself passed as a parameter to any event handler functions that you subscribe or register to JSDO events, any returned jQuery Promises, and to the online and offline events of the session that manages Data Object Services for the JSDO. This object is also returned as the value of any JSDO invocation method that you execute synchronously.
Note: Error information returned with this property is most useful, and in one case is only possible, when the autoApplyChanges property is false, where you can individually reject or accept JSDO memory changes associated with each resource operation. When autoApplyChanges is true, the JSDO automatically rejects any JSDO memory changes associated with operation errors, but clears any error conditions and information associated with the operations only after the final after* event has been fired and handled (if handled) for the operation.
Note: Any any errors that result from a Data Object resource operation invoked by the most recent execution of the fill( ) or saveChanges( ) method remain available for return by the getErrors( ) method until the next execution of fill( ) or saveChanges( ), regardless of the setting of autoApplyChanges.
Note: If a given resource does not support before-imaging, any information for an individual record-change error from a CUD operation is typically returned in the response property, as described above. In the callback for an afterSaveChanges event, or in any callback for a Promise object, in response to executing saveChanges(false) (invoking CUD operations), you can also inspect the returned response property to find any error information, as described above.

See also:

autoApplyChanges property, fill( ) method, getErrors( ) method, getErrorString( ) method, invocation method, invoke( ) method, jsrecord property, jsrecords property, saveChanges( ) method, xhr property