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)

                }

            });

<html>

    <body>

         <div id=’errorMsg’ class=”display”>

                <p>No Data Found</p>

         </div>

        <div id=’error’ class=”display”>

                <p>404 No Found</p>

         </div>

    </body>

</html>

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply