I’m making a simple ajax call in JavaScript which returns an ID, I then need to make another ajax call to fetch an XML file which contains all of the ID’s with the relevant descriptive string as part of the XML.
The ID’s description comes back in this format:
<Category>
<Id>1</Id>
<Descriptor>Accounts</Descriptor>
</Category>
<Category>
<Id>2</Id>
<Descriptor>Marketing</Descriptor>
</Category>
<Category>
<Id>3</Id>
<Descriptor>HR</Descriptor>
</Category>
etc...
How can I lookup the ID value against this XML and return the Descriptor string using JavaScript?
With jQuery you could do:
jQuery will treat it as html, but it seems to work all the same.
FIDDLE