Using jQuery to parse XML
First post.
Looking to parse the XML file a perl script sends back. I want to get values from specific tags in the XML file. Here is my code:
$.ajax({
type: "GET",
url: 'http://servername/cgi-bin/findwhoisonduty.pl?host='+groupName,
dataType: "xml",
success: function parseXml(xml){
$xml.find('ax21:user').each(function(){
var firstName = $(this).find('ax21:firstName').text();
var lastName = $(this).find('ax21:lastName').text();
});
alert(firstName + " " + lastName);
}
});
The code seems to be getting hung up on the dataType: "xml", line because when I comment it out, it goes to the next step and executes the function (although it doesn't do anything).
Are there any suggestions as to how I can change this or just take a different approach? Let me know if I can provide more information.