Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$(document).ready(function() {
$("#search").click(function() {
var searchString = document.getElementById('searchbar').value;
var filteredSearch = searchString.replace(" ", "%20");
var address = "https://en.wikipedia.org/w/api.php?action=query&origin=*&titles=" + filteredSearch + "&prop=revisions&rvprop=content&format=json&callback=?";
console.log(address);
$.getJSON(address, function(json) {
console.log("Ok! I am running!");
var articleName = json.title;
$("#posthere").text(articleName);
console.log(articleName);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.