Jquery parse xml
I have a xml variable like
var xmlData="<evn:soap><con:firstname>ravindra</con:firstname></evn:soap>";
Now I would like to parse this
I have done
alert($(xmlData).find('firstn开发者_开发知识库ame').text());
But not able to get output. even also try like
alert($(xmlData).find('con:firstname').text());
Please suggest.
The :
makes jQuery think firstname
is a custom selector. You need to escape it with a double backslash (\\
) to tell jQuery that it is part of the tag name:
alert($(xmlData).find('con\\:firstname').text());
精彩评论