Greeting all, I'm sure this is quite simple; however not sure how do it. I want to be able to get a specific xml node from the xml document using a function call after I have initially retrieved it with jquery. Hope my code will explain better:
XML DOC: <?xml version="1.0" encoding="ISO-8859-1"?> <schedule> <show> <date>Monday, May 14, 2007</date> <dayofweek>Monday</dayofweek> <image>051407.jpg</image> <title>San Antonio Hosts Training for Ministry Conference</title> <description>Text Here</description> <filename>2007-5-14.asx</filename> <guests/> <specialoffer>Names of God bracelet</specialoffer> <specialofferproductid>431</specialofferproductid> </show> <show> <date>Tuesday, May 15, 2007</date> <dayofweek>Tuesday</dayofweek> <image>051507.jpg</image> <title>Training for Ministry Conference Impacts the Alamo City</ title> <description>More Text Here</description> <filename>2007-5-15.asx</filename> <guests/> <specialoffer>Names of God bracelet</specialoffer> <specialofferproductid>431</specialofferproductid> </show> </schedule> JQUERY CODE: <script type="text/javascript"> $(function() { $.ajax({url: 'tiydschedule.xml', type: 'GET', dataType: 'xml', timeout: 1000, error: function(){ alert('Error loading XML document'); }, success: function(xml){ $('show',xml).each(function(id){ var dayofweek = $(this).find('dayofweek').text(); var image = $(this).find('image').text(); var divrow = '<div><h4>'+dayofweek+'</h4><p><a href="#" onclick="getShow(this);"><img src="/images/weekly_guide/'+image+'" class="today" width="105" height="75"/></a></p></div>'; $('.wkguidedays').append(divrow); }); } }); }); function getShow(xmlnode) { // do something with xmlnode var date = $(xmlnode).find('date').text(); var dayofweek = $(xmlnode).find('dayofweek').text(); var image = $(xmlnode).find('image').text(); var title = $(xmlnode).find('title').text(); var description = $(xmlnode).find('description').text(); var filename = $(xmlnode).find('filename').text(); var guests = $(xmlnode).find('guests').text(); var specialoffer = $(xmlnode).find('specialoffer').text(); var specialofferproductid = $ (xmlnode).find('specialofferproductid').text(); alert(title); } </script> The first part works fine; however the call to the getShow(xmlnode) function which I want to receive the passed xml node does not work. I'm appending <a href="#" onclick="getShow(this);"> to the divrow variable as I initially loop thru the xmlnodes. Nothing shows up on the alert. Is there a simpler way to do this? I am on the right track? Thanks for the help.