Last active
June 5, 2018 15:42
-
-
Save waldothedeveloper/804f36e70d7f82548f7ca8f95539500b 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
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