Skip to content

Instantly share code, notes, and snippets.

@edinsoncs
Created December 31, 2015 22:58
Show Gist options
  • Select an option

  • Save edinsoncs/7885317cbc1004b00ca5 to your computer and use it in GitHub Desktop.

Select an option

Save edinsoncs/7885317cbc1004b00ca5 to your computer and use it in GitHub Desktop.
api
(function(){
var xhr = new XMLHttpRequest;
var API = "https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch";
var SEARCH = prompt("Que vas a buscar?");
xhr.onreadystatechange = function(){
if (xhr.readyState == 4 && xhr.status == 200) {
JSON.parse(xhr.responseText);
}
}
xhr.open('GET', API + SEARCH);
xhr.send();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment