Created
April 28, 2018 03:55
-
-
Save DiegoPinho/49d6c04af85266f88b1be849dd6cb787 to your computer and use it in GitHub Desktop.
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
function searchForTermOnWikipedia(term) { | |
// example: https://en.wikipedia.org/w/api.php?action=opensearch&search=zyz&limit=1&namespace=0&format=jsonfm | |
var action = 'action=opensearch'; | |
var search = 'search=' + term; | |
var format = 'json'; | |
var params = '?' + action + '&' + search + '&' + format + '&callback=?'; | |
var url = WIKIPEDIA_API_URL + params; | |
$.getJSON(url, function(data) { | |
// faz algo com o resultado... | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment