I get Atom data through Ajax using jQuery.
I write
$(xhr).find('entry id').eq(0).html();
is OK.
But
$(xhr).find('entry title').eq(0).html();
can not select anything.
title tag is actually exist.
Please help. Thank you!
I get Atom data through Ajax using jQuery.
I write
$(xhr).find('entry id').eq(0).html();
is OK.
But
$(xhr).find('entry title').eq(0).html();
can not select anything.
title tag is actually exist.
Please help. Thank you!
That is because there is no title
element in the Atom XML. The actual name is atom:title
if the XML namespace http://www.w3.org/2005/Atom
was mapped to the namespace prefix atom
.
Your problem is that jQuery is a HTML library, not an XML library. Therefore, it has some shortcomings when it comes to handling real XML data.
What you need is a plugin. This IBM developerworks article should give you some idea what I'm talking about and how to solve it.