小编use*_*851的帖子

使用 jQuery 从媒体中获取 URL:RSS XML 提要中的内容

我正在尝试从media:contentRSS 提要中的每个帖子中检索图像(以及其他内容):http : //bits.blogs.nytimes.com/feed/

我尝试了这个链接(以及许多其他链接)jQuery XML parsing how to get element attribute, 但我仍然遇到错误。

还有一个 PHP 文件(见底部),但我不认为这是问题所在。

我已经尝试了几种变体,但我最终得到了 <img src="undefined" alt="image">

这就是日志所说的 TypeError: 'undefined' is not an object (evaluating '$item.find('media\\:content').attr('url').text')

这是来自 RSS 提要的 XML 示例(我试图获取 url="this value" 中的内容) <media:content url="http://graphics8.nytimes.com/images/2011/11/30/technology/bits-daily-report/bits-daily-report-thumbStandard.jpg" medium="image" width="75" height="75"></media:content>

这是我的带有 jQ​​uery Embeded 的 HTML。感谢您提供所有解决方案、指示和建议。我现在遇到了障碍。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Your Site Title</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

function get_rss_feed() {

// RSS …
Run Code Online (Sandbox Code Playgroud)

html rss jquery xml-parsing

4
推荐指数
1
解决办法
5703
查看次数

标签 统计

html ×1

jquery ×1

rss ×1

xml-parsing ×1