How to Show or Display Error Message on label using JQuery


How to show Alert (Error) Messages on Dialog Box (label) using JQuery 

jQuery is a JavaScript library. It allows web developers to incorporate cutting edge features into websites, by allowing them to plug specific web technologies such as CSS, JavaScript, HTML, and PHP into their web applications.

The software provides a clean interface that makes the application experience “clean and fluid.”

AJAX  (Asynchronous JavaScript and XML ) is that the art of exchanging data with a server, and updating parts of an online page - without reloading the entire page.

The ajaxError() method specifies the function to be executed when the Ajax request fails.

NOTE : Starting from jQuery version 1.8, this method only needs to be attached to the document.

Syntax : 

$(document).ajaxError(function(event,xhr,options,exc))

Today we will learn how to show error messages on a label using Jquery.

Now, view the code.....

<!DOCTYPE html>

<html>

  <head>

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">

      </script>

      <script>

                   $(document).ready(function(){

                          $(document).ajaxError(function(){

                             alert("TECH Error Message is Occure! ");

                           });

                     $("button").click(function(){

                        $("div").load("wrongfile.txt");

                          });

                       });

       </script>

  </head>

  <body>

       <div>

               <h2>Lets, join to TECHnolearnTECHnic</h2>

       </div>

      <button> Join </button>

  </body>

</html> 


Code on Editor 


Output


















This Error message Dialog Box or Label.









Post a Comment

0 Comments