Read Unknown-sized Array in Ajax from XML

x1800

New Member
How can I read and sign XML data (array of different sizes) using jQuery?AJAX to read line node from XML and store in javascript array, in XML array size is not constant.My Code:\[code\]$(document).ready(function(){ $.ajax({ type: "GET", url: "sites.xml", dataType: "xml", success: function(xml) { $(xml).find('msg').each(function() { var title = $(this).find('title').text(); i = 0; tic = new Array(); $(this).find('desc').each(function() { tic.push($(this).find('line').text()); alert(tic); i++; }); }); } });});\[/code\]and XML File (Demo)\[code\]<msgs> <msg> <title>ABC</title> <desc> <line>test 1</line> <line>test 2</line> <line>test 2</line> </desc> <time>5</time> </msg></msgs>\[/code\]Can Someone help me out please
 
Back
Top