Check JSON data length and Error property in Ajax call(SAPUI5).
Hi,
Please find the below code that will help you to display a custom message to user if you are not finding any data from XSODATA service.
jQuery.ajax({
url : “your URL”
dataType : “json”,
success : function(data, textStatus, jqXHR) { // callback called when data is received
if (data.d.results.length == 0) { // if data length is 0 then it assumnes that No matching data found and append the message
$(‘#errorMsg’).show();
} else {
// fill the received data into the JSONModel
}
},
error : function(jqXHR, textStatus, errorThrown) {
$(‘#error’).show(); //This will help you to throw a message to the user if URL is not correct like (404,401 etc)
}
});
No Data Found
404 No Found
New NetWeaver Information at SAP.com
Very Helpfull