1

What is the best way to retrieve data from multiple websites/pages and put them on 1 single application that gets auto-updated? say ,I want to take an article from yahoo, and another one from bbc and another one from the times then put them on a sort of listview, that gets autoUpdated, how would I go for that? I heard about JSON, but Since I'm new in jQuery Mobile programming, I'm not sure how this will work. Do I have to first, implement JSON on the websites I wanna take the article from, then use a JSON call from my App?or is there another way of doing this? Thanks for your advice in advance.

Regards, Ben

Gajotres
  • 57,309
  • 16
  • 102
  • 130
  • jQuery will run on clients. To get data from several sites, you'll end up facing [cross-domain issues](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing). The simplest way is to build a **server-side** web application that (1) will gather info from all those sites; (2) enrich them as you need and (3) serve them (in JSON format, probably) in the same domain as your jQuery-html page. – acdcjunior May 12 '13 at 19:17

1 Answers1

2

It is not that hard.

There's no point in doing anything by yourself. Every major news site has a RSS feed. All you need is a jQuery RSS reader that can be used for article pulling. They can be than appended to the jQuery Mobile listview.

Here's one great jQuery RSS plugin: https://github.com/sdepold/jquery-rss

What to do:

  1. Create skeleton jQuery Mobile page
  2. Use RSS plugin to retrieve at least 10-30 articles
  3. Store articles in localStorage
  4. Display them in a listview
  5. Create another page
  6. When user clicks on a listview element pass a article parameter to the second page. Read my other article to find out how you can pass parameters from page to page: https://stackoverflow.com/a/14469041/1848600
  7. Before second page is loaded read rest of article data (from localStorage) and dynamically build page content. Read my other article how you can enhance markup of a dynamically created jQuery Mobile page: jQuery Mobile: Markup Enhancement of dynamically added content
Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130
  • Thanks very much for the prompt answer. If it's not a news site, but a private site, how would I go on doing, in the event that that private site does not use RSS feed? Thanks – NewInProgramming May 12 '13 at 19:53
  • If that private side is yours you can do it like this: http://stackoverflow.com/a/15205612/1848600 with json. You can even use other sites if they would allow you to access them, again with json. – Gajotres May 12 '13 at 19:57