fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").load("wrongname.xml",function(response,status,xhr){ if (status=="success"){ $("div").html("<ol></ol>"); $(response).find("artist").each(function(){ var item_text = $(this).text(); $('<li></li>').html(item_text).appendTo('ol'); }); }else{ $("div").html("错误信息: <br/>" + xhr.status + " " + xhr.statusText) } }); }); }); </script> </head> <body> <p>艺术家</p> <div></div> <button>获取 CD 信息</button> <p> XML 文件实例为 <a href="demo_cd_catalog.xml" target="_blank">demo_cd_catalog</a></p> </body> </html>
运行结果