Created
December 23, 2016 12:42
-
-
Save toocool/2c9a8c9c77c7dd31f5e668234b87d854 to your computer and use it in GitHub Desktop.
get info from wikipedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function dowiki(place) { | |
var URL = 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext='; | |
URL += "&titles=" + place; | |
URL += "&rvprop=content"; | |
URL += "&callback=?"; | |
$.getJSON(URL, function (data) { | |
var obj = data.query.pages; | |
var ob = Object.keys(obj)[0]; | |
console.log(obj[ob]["extract"]); | |
try{ | |
document.getElementById('Label11').textContent = obj[ob]["extract"]; | |
} | |
catch (err) { | |
document.getElementById('Label11').textContent = err.message; | |
} | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment