Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script src="http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(document).ajaxError(function(e,xhr,opt){ alert("Error requesting " + opt.url + ": " + xhr.status + " " + xhr.statusText); }); $("button").click(function(){ $("div").load("wrongfile.txt"); }); }); </script> </head> <body> <div><h2>使用 AJAX 修改文本</h2></div> <button>修改内容</button> </body> </html>