首页
极刻
圈子
教程
开源
极客社区
写文章
发极刻
建圈子
发项目
登录 / 注册
返回教程:jQuery 教程
TRY RUN / 在线示例
jQuery 教程 生成带有错误的 AJAX 请求
jQuery 教程 生成带有错误的 AJAX 请求
源代码
运行
<!DOCTYPE html> <html> <head> <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $.ajax({url:"wrongfile.txt",error:function(xhr){ alert("错误提示: " + xhr.status + " " + xhr.statusText); }}); }); }); </script> </head> <body> <p>艺术家</p> <div></div> <button>获取 CD 信息</button> </body> </html>
运行结果