I've been trying to make atom feed work using jQueryMobile since last night but no luck. I am working the code locally.
I am using this scripts provided in jQueryMobile site
<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>
I tried a lot of code and I end up using the code answered in this question Parse RSS with jQuery
this is my code
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);
});
});
}
at the end, I tried popping up an alert but it's not showing anything.
what's wrong in the code?
--- update ---
I am working with mobile devices
--- update ---
for the sake debugging. here's an updated code
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");
}
so I added alerts .. the problem there is
it only popups in "start call" and "end call".
My sample xml looks like this.. but this is actually a lot longer
<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>