json - JavaScript extract certain data from Wikipeida API -
how extract highlighted(in green) data wikipedia api , display on front-end. want separate value , display separately in front-end.

function getjsonp(url, success) { var ud = '_' + +new date, script = document.createelement('script'), head = document.getelementsbytagname('head')[0] || document.documentelement; window[ud] = function(data) { head.removechild(script); success && success(data); }; script.src = url.replace('callback=?', 'callback=' + ud); head.appendchild(script); } getjsonp('http://en.wikipedia.org/w/api.php?format=json&action=query&titles=list_of_metropolitan_areas_by_population&prop=revisions&rvprop=content&callback=?', function(data){ console.log(data); document.getelementbyid("title").innerhtml = data.query.pages[125279].title; var incontent = data.query.pages[125279].revisions[0]; document.getelementbyid("con").innerhtml = incontent; }); <div id="title"></div> <div id="con"></div>
Comments
Post a Comment