I have the following XML file:
<?xml version="1.0" encoding="iso-8859-1"?>
<words>
<word>
<id>1</id>
<name>Teacher</name>
</word>
<word>
<id>2</id>
<name>Pitcher</name>
</word>
</words>
And the following jQuery code:
$.ajax({
type: "GET",
url: "sites.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('word').each(function(){
...
});
How can I get word with ID == 1?
This ajax function is inside another function (getWord() function). I want to get word with any ID and assign that value to a local variable of getWord() function.
How can I do that?