开发者

getting rss news feed using jquery mobile

I am making a mobile web app. This app will get news from yahoo. I am currently using jquery plugin to get these news. I am also using jquery mobile for interface. On the index page I have listview and it contains all the titles such as Top News, World News, Sports News etc. Here is index page code

<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width = device-width, initial-scale = 1, user-scalable = no" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
</head>
<body>
    <div data-role="page">
        <header data-role="header">
            <h1>Yahoo News</h1>
        </header>
        <div data-role="content">
            <ul data-role="listview" data-inset="true">
                <li><a href="topNews.php" data-transition="slidedown">Top Stories</a></li>
                <li><a href="worldNews.php" data-transition="slidedown">World News</a></li>
                <li><a href="techNews.php" data-transition="slidedown">Technology</a></li>
                <li><a href="scienceNews.php" data-transition="slidedown">Science</a></li>
                <li><a href="enterNews.php" data-transition="slidedown">Entertainment</a></li>
                <li><a href="sportsNews.php" data-transition="slidedown">Sports</a></li>
            </ul>
        </div>
        <footer data-role="footer">
            <h4>Footer</h4>
        </footer>
    </div>
</body>

So when USer clicks lets say Top Stories then it will take user to appropriate page and display top news on that page. Now it does take user to top news page but when he gets there he does not see any news. That page is empty. But when user refresh this page by clicking refresh button of the browser then it does show all the news. So my problem is that it should display the news as top news page is displayed.

here is top news page code

<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width = device-width, initial-scale = 1, user-scalable = no" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="http://co开发者_开发技巧de.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
    <script language="javascript" type="text/javascript" src="jquery.jfeed.js"></script>
    <script language="javascript" type="text/javascript" src="jquery.aRSSFeed.js"></script>
    <script type="text/javascript">
    $(document).ready( function() {
        $('div.RSSAggrCont').aRSSFeed();
    });
    </script>
</head>
<body>
    <div data-role="page">
        <header data-role="header">
            <a href="#" data-transition="slidedown" data-rel="back" data-icon="arrow-l">Back</a>
            <h1>Top News</h1>
        </header>
        <div data-role="content">
            <div class="RSSAggrCont" rssnum="5" rss_url="http://rss.news.yahoo.com/rss/topstories">

            </div>
        </div>
        <footer data-role="footer">
            <h4>Footer</h4>
        </footer>
    </div>
</body>

Can someone tell me where am I making mistake? Any solution Please


There is a brilliant article called How to build an RSS reader with Jquery Mobile. It takes you through every step of the process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜