<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/JAVAscript" src="js/jquery-3.3.1.min.js"></script> <script type="text/JavaScript"> $(function(){ $.get("xml/test.xml", function(data){ var book_list = $(data).find('book'); var book_length = book_list.length; var i = 0; var range; var author; var target; book_list.each(function(index, value){ range = $(this).children('range').text(); author = $(this).children('author').text(); target = $(this).children('target').text(); console.log(range+' '+author+' '+target); }); },'xml'); }); </script> </head> <body> </body> </html> <!-- <?xml version="1.0" encoding="utf-8" ?> <bookstore> <book> <range>前端专区1</range> <author>蚂蚁部落</author> <target>css教程</target> </book> <book> <range>前端专区</range> <author>蚂蚁部落</author> <target>div教程</target> </book> <book> <range>资源专区</range> <author>softwhy.com</author> <target>特效下载</target> </book> <book> <range>前端专区</range> <author>softwhy.com</author> <target>教程下载</target> </book> </bookstore> -->