XML:
<item>
<title>Some title</title>
<description>
<![CDATA[
Some description text Some description text Some description text Some description text Some description text Some description text
Some description text Some description text Some description text Some description text Some description text Some description text
Some description text Some description text Some description text Some description text Some description text Some description text
Some description text Some description text Some description text Some description text Some description text Some description text
]]>
</description>
<media:content isDefault="true" medium="image" url="http://sampledomain.com/image.jpg">
<media:title>Image title</media:title>
<media:description>Image description</media:description>
<media:thumbnail url="http://sampledomain.com/image.jpg" width="160" height="120" />
</media:content>
<wfw:commentRss>http://sampledomain.com/comment/feed/</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
我正在通过Ajax获取CSS,并在onsuccess函数中使用以下代码:
```javascript ```
请注意,我只是翻译文本,不会执行任何代码或更改格式。
$(xml).find('item').each(function() {
var title = $(this).find('title').eq(0).text();
var url = $(this).find('content').attr('url');
// Printing url as undefined
alert(url);
console.log($(this).find('content');
});
我想获取内容的url属性,我已经得到了项目的子元素(标题、描述、内容、评论Rss和评论),但是当我尝试使用$(this).find('content')时,它没有返回任何内容。有人能找出我做错了什么吗?谢谢。