开发者

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());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜