I've been googling this for an hour and can't seem to find the answer.
I'm using $(xml).find('title') -- but it seems to be returning all the "titles" in all nodes. How do I just grab the title within the root node?
<response stat="OK">
<title>Some Document</title>
<menu>
<item>
<title>Some Title</title>
<url>/</url>
</item>
<item>
<title>Some Title 1</title>
<url>/asdfasdf/</url>
</item>
</menu>
</response>
returns "Some DocumentSome TitleSome Title 1"
// Loads the page content and inserts it into the content area
$.ajax({
dataType: 'xml',
url: 'someurl',
success: function(data, textStatus, XMLHttpRequest) {
// returns
console.log($(data).find('title').text());
}
I just want the first title! I would rather not use xpath, i'd rather use the cheapest solution.