I want to use jQuery to display the contents of a Wikipedia info box containing company information.
I think I'm almost there, but I just can't take the last step on the road
var searchTerm="toyota"; var url="http://en.wikipedia.org/w/api.php?action=parse&format=json&page=" + searchTerm+"&redirects&prop=text&callback=?"; $.getJSON(url,function(data){ wikiHTML = data.parse.text["*"]; $wikiDOM = $(wikiHTML); $("#result").append($wikiDOM.find('.infobox').html()); });
The first part works - wikiHTML contains page content parsed by the Wikipedia API in HTML format
This contains a table with the contents of the info box:
<table class="infobox vcard" cellspacing="5" style="width:22em;">
the result is just an empty table placeholder to put data in
It works with some other page elements - for example, swapping.infobox for .logo works fine.
I am pleased to provide more information, but I spent many hours on it and tried so many permutations that I'm not even sure what is relevant ...
TIA
source share