Struggling to figure this out.
I've got an XML file that I call with ajax, then I need to set the element text as variables.
Two of the elements have the same name, and I don't know how to get them separately:
<myElement>
<Country>
<Id>1</Id>
<CountryCode>UK</CountryCode>
**<Name>United Kingdom</Name>**
</Country>
<County>
<Id>7</Id>
**<Name>West Midlands</Name>**
</County>
</myElement>
This is how I currently get them:
$(results).find("myElement").each(function (i, item) {
var countryName = $(this).find('Name').text();
var countyName = **$(this).find(' ???? ').text();**
});
Not come across this before, but the XML file ISN'T mine so I can't just rename the elements.