0
我一直在尝试使用jQueryMobile原子饲料工作,因为昨晚但没有运气。 我在本地工作的代码。需要在使用jQueryMobile原子饲料的帮助
我正在使用jQueryMobile网站提供了这个脚本
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
我尝试了很多的代码,我最终使用的代码回答了这个问题Parse RSS with jQuery
这是我的代码
function refreshFeed2() {
$.get("resp2.xml", function (data) {
var $xml = $(data);
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
author: $this.find("author").text()
}
alert(item.title);
});
});
}
最后,我试着弹出警报,但没有显示任何内容。
代码有什么问题?
---更新--- 我的工作与移动设备 ---更新---
为求调试。这里是一个更新的代码
function refreshFeed2() {
alert("start call");
$.get("resp.xml", function (data) {
alert("start parse");
var $xml = $(data);
alert("set data");
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
link: $this.find("link").text(),
description: $this.find("description").text(),
pubDate: $this.find("pubDate").text(),
author: $this.find("author").text()
}
alert(item.title);
});
});
alert("end call");
}
所以我加了警报。该问题有 它只是在“开始呼叫”和“结束通话”弹出窗口。
我的示例XML看起来是这样的..但其实这是一个很长时间
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<title>title of the feed</title>
<atom:link href="http://www.mainlink.com/livefeed" rel="self" />
<link>http://www.mainlink.com/</link>
<description>
</description>
<language>en-us</language>
<pubDate>Fri, 06 Jul 2012 04:47:51 +0800</pubDate>
<lastBuildDate>Fri, 06 Jul 2012 04:47:51 +0800</lastBuildDate>
<item>
<title>title1</title>
<link>http://www.link1.com/</link>
<description>desc1</description>
<pubDate>Fri, 06 Jul 2012 04:47:09 +0800</pubDate>
<guid>25542832</guid>
</item>
<item>
<title>title2</title>
<link>http://www.link1.com/</link>
<description>desc2</description>
<pubDate>Fri, 06 Jul 2012 04:47:09 +0800</pubDate>
<guid>25542831</guid>
</item>
</channel>
</rss>
我更新了代码。 – 2012-07-06 03:05:16
太棒了。您仍然必须在断点处下载并逐步执行代码,以查明我提到的两个可能的问题中的哪一个出现了问题。我们不能告诉你,例如,“resp2.xml”是否为您的文件或是否您的服务器已正确配置为返回该文件 – 2012-07-06 03:17:48
它在我的网站工作http://www.jaysonragasa.net/正确的URL文件/测试/ index.html的,但不是本地..反正.. – 2012-07-06 03:27:31