user1124378
user1124378

Reputation:

jQuery AJAX & XML getting node value

I have the following code that grabs the text in xml nodes

$(xml).find('entry').each(function(){
     alert($(this).find('author').text());
});

This will alert what ever text happens to be in each <name>

I am struggling to get the text value in a node that looks like this -

<im:name>

Changing my code to look like this -

$(xml).find('entry').each(function(){
     alert($(this).find('im:name').text());
});

Doesn't work, can someone point me in the right direction please.

I have tried searching but don't know what to call a node that is in this format!

Thanks

Upvotes: 2

Views: 1955

Answers (1)

Ram
Ram

Reputation: 144659

You can escape the :.

alert($(this).find('im\\:name').text());

http://jsfiddle.net/6Y2ff/

Upvotes: 2

Related Questions