Advertisement
mArtti

Untitled

Jun 5th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. getResults() {
  2. fetch(universityData.root_url+'/wp-json/wp/v2/posts/?search='+searchField.value)
  3. .then(res => res.json())
  4. .then((out) => {
  5. resultsDiv.innerHTML = '
  6. <h2 class="search-overlay__section-title">General Information</h2>
  7. <ul class="link-list min-list">
  8. ${!out.length ? <p>No General Information Matches That Search<p>
  9. ${out.map(arr => '<li><a href="${arr.link}">${arr.title.rendered}</a></li>).join('')}
  10. </ul> '}
  11. ';
  12. }).catch(err => resultsDiv.innerHTML = <p>There was a problem with the search.<p>);
  13. isSpinnerVisable = false;
  14. },
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement