jquery load xml file

Solutions on MaxInterview for jquery load xml file by the best coders in the world

showing results for - "jquery load xml file"
Flavio
26 Aug 2020
1$(document).ready(function(){
2   $.ajax({
3    type: "GET" ,
4    url: "sampleXML.xml" ,
5    dataType: "xml" ,
6    success: function(xml) {
7
8    //var xmlDoc = $.parseXML( xml );   <------------------this line
9    //if single item
10    var person = $(xml).find('person').text();  
11
12    //but if it's multible items then loop
13    $(xml).find('person').each(function(){
14     $("#temp").append('<li>' + $(this).text() + '</li>');  
15    }); 
16    }       
17});
18});