Question

I've been trying to come up with a solution to get links/pages (dunno what it's called) from a MediaWiki category page using simple jQuery. I'm been reading the API docs but don't really know what to look for.

If you look at this page you'll see release dates for video games.. that's the information I want to obtain. And this is as far as I got:

var title="Upcoming_video_games";

$.getJSON("http://en.wikipedia.org/w/api.php?action=query&list=allpages&titles="+title+"&format=json&callback=?", function(data) {
    console.log(data);
});

Does someone know how to do this? Any help is appreciated.

TIA

Was it helpful?

Solution

Try this

var url = "http://en.wikipedia.org/w/api.php?action=parse&format=json&callback=?";
var page = "Pune"; // your page title, eg. New_York

$.getJSON(url, { 
  page: page, 
  limit:1,
  prop:"text|images", 
  uselang:"en"
}, function(data) {
  var $container = $("body")

  // append body
  //$container.append(data['parse']['text']['*']); 

Then get data in var and use find function each object like images, title, or some tags.. Abhijeet...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top