Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@waldothedeveloper
Last active June 5, 2018 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waldothedeveloper/804f36e70d7f82548f7ca8f95539500b to your computer and use it in GitHub Desktop.
Save waldothedeveloper/804f36e70d7f82548f7ca8f95539500b to your computer and use it in GitHub Desktop.
if (data.query === undefined) {
$("#results").append(
`<div class="list-group">
<div class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Suggestions:</h5>
</div>
<li class="mb-1">Make sure all words are spelled correctly.</li>
<li class="mb-1">Try different keywords.</li>
<li class="mb-1">Try more general keywords.</li>
</div>
</div>`
);
} else {
let articles = data.query.pages;
for (let value of Object.values(articles)) {
$("#results").append(`<a href="#" onclick="window.open('https://en.wikipedia.org/?curid=${value.pageid}')" class="list-group-item list-group-item-action flex-column align-items-start">\
<div class = "d-flex w-100 justify-content-between">\
<h5 class = "mb-1">${value.title}</h5>\
</div>\
<p class="mb-1">${value.extract}</p>\
</a>`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment