如何使用JSON从Wikipedia API检索数据?
问题描述:
这里我使用以下代码从*中获取数据。但它不适合我。
Here I am fetching the data from Wikipedia using following code. but it is not working for me.
var playListURL = 'http://en.wikipedia.org/w/api.php?format=json&action=query&titles=India&prop=revisions&rvprop=content&callback=?';
$.getJSON(playListURL ,function(data) {
$.each(data.pages, function(i, item) {
alert(i);
});
});
DEMO LINK: - http://jsfiddle.net/rushijogle/dyeqy/
DEMO LINK :- http://jsfiddle.net/rushijogle/dyeqy/
答
使用下面的代码来获取数据:
Use the following code to get the data:
$.getJSON(playListURL ,function(data) {
$.each(data.query.pages, function(i, item) {
alert(item.title);
});
});