Trouble with parsing XML Attributes with jQuery

rdunksgok

New Member
I'm pretty new to jquery xml parsing and have hit a wall.I have an XML source data file like this called tracker2.xml (very simple):\[code\]<spotter num="17555" report_at="2013-01-29 04:05:17" lat="45.0463562" lng="-93.4922943"></spotter>\[/code\]I am trying to pull "lat", "lng", and "report_at" as variables to use later in the code. I have this so far and to me seems to be the proper code. I added the alert(report_at) to troubleshoot. When run, the alert displays "[object]".\[code\] $(document).ready(function() { $.ajax({ type: "GET", url: "tracker2.xml", dataType: "xml", success: parseXml }); });function parseXml(xml) { $(xml).find('spotter').each(function() { var report_at = $(this).attr('report_at'); var lats = $(this).attr('lat'); var lngs = $(this).attr('lng'); });}alert(report_at);\[/code\]I'm sure i am missing something stupid. Anyone that can help me will be my hero. Thanks!!
 
Back
Top