Javascript examples for jQuery Method and Property:ajax
Handle error for Ajax call
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "wrongfile.txt", error: function(xhr){ console.log("An error occured: " + xhr.status + " " + xhr.statusText); }});// w w w.j av a2 s. c om }); }); </script> </head> <body> <p>Artists</p> <div></div> <button>test</button> </body> </html>