jQuery ajaxError()
show url and status
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>// w w w. j ava 2 s.c om <script> $(document).ready(function(){ $(document).ajaxError(function(e, xhr, opt){ document.getElementById("demo").innerHTML = "Error requesting " + opt.url + ": " + xhr.status + " " + xhr.statusText; }); $("button").click(function(){ $("div").load("wrongfile.txt"); }); }); </script> </head> <body> <p id="demo"></p> <div><h2>Here</h2></div> <button>Change Content</button> </body> </html>