欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

JS使用ajax从xml文件动态获取数据显示的方法_javascript技巧

程序员文章站 2022-04-16 17:47:43
...
本文实例讲述了JS使用ajax从xml文件动态获取数据显示的方法。分享给大家供大家参考。具体分析如下:

下面的JS代码通过ajax检索xml文件的内容动态展示到网页,真个页面无刷新



xml文件内容如下

Empire Burlesque
Bob DylanUSAColumbia10.901985Hide your heart
Bonnie TylerUKCBS Records9.901988Greatest Hits
Dolly PartonUSARCA9.901982Still got the blues
Gary MooreUKVirgin records10.201990Eros
Eros RamazzottiEUBMG9.901997One night only
Bee GeesUKPolydor10.901998Sylvias Mother
Dr.HookUKCBS8.101973Maggie May
Rod StewartUKPickwick8.501990Romanza
Andrea BocelliEUPolydor10.801996When a man loves a woman
Percy SledgeUSAAtlantic8.701987Black angel
Savage RoseEUMega10.9019951999 Grammy Nominees
ManyUSAGrammy10.201999For the good times
Kenny RogersUKMucik Master8.701995Big Willie style
Will SmithUSAColumbia9.901997Tupelo Honey
Van MorrisonUKPolydor8.201971Soulsville
Jorn HoelNorwayWEA7.901996The very best of
Cat StevensUKIsland8.901990Stop
Sam BrownUKA and M8.901988Bridge of Spies
T'PauUKSiren7.901987Private Dancer
Tina TurnerUKCapitol8.901983Midt om natten
Kim LarsenEUMedley7.801983Pavarotti Gala Concert
Luciano PavarottiUKDECCA9.901991The dock of the bay
Otis ReddingUSAAtlantic7.901987Picture book
Simply RedEUElektra7.201985Red
The CommunardsUKLondon7.801987Unchain my heart
Joe CockerUSAEMI8.201987

希望本文所述对大家的javascript程序设计有所帮助。