Revision: 23894
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 16, 2010 15:37 by vagrantradio
Initial Code
$(document).ready(function() { $.ajax({ type: "GET", url: "data.xml", dataType: "xml", success: parseXml }); function parseXml(xml) { $(xml).find("location").each(function() { //find each instance of popupTitle in xml file var popupTitle = $(this).find("popupTitle").text(); //if blank hide row if (popupTitle == "") { $("table#table tbody tr").hide(); } else { //else add tr and td tags and add alt class for striping $("table#table tbody").append("<tr>" + "<td nowrap='nowrap'>" + $(this).find("popupTitle").text() + "</td>" + "<td>" + $(this).find("popupDescription").text() + "</td>" + "</tr>"); $('table#table tbody tr:even').addClass('alt'); } }); } });
Initial URL
http://www.vagrantradio.com/2009/10/how-to-parse-xml-using-jquery-and-ajax.html
Initial Description
jQuery Ajax function to load xml data into a table and add class to even rows for striping.
Initial Title
JQUERY / AJAX PARSE XML TO TABLE
Initial Tags
css, ajax, table, data, html, xml, jquery
Initial Language
jQuery