I did not find in the SAPUI5 documentation how to access the server response text using a function to handle the request complete event (method attachRequestCompleted of the sap.ui.model.Model).
Example scenarios
Please consider the successful JSON response below. The user could see this information in the view controls through binding, right? So he or she will know that the server returned something.
{
"success": true,
"data": [
{
"name_first": "christian",
"name_last": "jianelli"
}
]
}
Now consider this second JSON response:
{
"success": true,
"data": []
}
The communication with the server was successful but it returned an empty result. The user will not see any information in the view, right?
If I wanted to handle this response by showing a message box like "No data found for this selection criteria"....
Consider now this last scenario:
{
"success": false,
"data": [],
"msg": "Access denied"
}
If I wanted to show this message to the user in a message box...
How can i do that?
Thanks in advance
😉