Verify Image Exist in given URL using Ajax Call in JQuery

It's  ease to verify the Image exist in given URL or not with the help of Ajax call in JQuery.
 
Step 1:
 
Create a HTML Design which is written below: 
  1. <html xmlns="http://www.w3.org/1999/xhtml">  
  2.   
  3.     <head>  
  4.         <title></title>  
  5.         <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />  
  6.         <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>  
  7.     </head>  
  8.   
  9.     <body>  
  10.         <form id="form1">  
  11.             <div class="container">  
  12.                 <div class="row">  
  13.                     <br>  
  14.                     <div class="form-inline"> <b>Enter Url:</b>  
  15.                         <input type="text" id="txtUrl" />  
  16.                         <input type="button" value="Check Status" id="btnStatus" class="btn-default" /> </div>  
  17.                 </div>  
  18.             </div>  
  19.         </form>  
  20.     </body>  
  21.   
  22. </html>  
Step 2: Create a JQuery script  to verify the Image present in the URL or Not which is written below:
  1. $(function()  
  2. {  
  3.     $('#btnStatus').click(function()  
  4.     {  
  5.         $.ajax(  
  6.         {  
  7.             url: $('#txtUrl').val(),  
  8.             success: function(data)  
  9.             {  
  10.                 alert('Image Exists');  
  11.             },  
  12.             error: function(data)  
  13.             {  
  14.                 alert('Image does not exist');  
  15.             }  
  16.         });  
  17.     });  
  18. })  
Result in Browser:
 
  
                                                      Figure 1



                                                                                 Figure 2


                                                                              Figure 3