Last active
April 8, 2018 02:01
-
-
Save zenorocha/476ddc57577f61800501 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var searchInput = document.querySelector('#search-input'); | |
searchInput.addEventListener('input', function() { // Triggers when a user writes something | |
Launchpad // Uses Launchpad API Client to make an AJAX request | |
.url('http://liferay.io/docs/search/all') // Points to the API URL where the data is stored | |
.search('*', 'prefix', searchInput.value) // Filters results based on what the user typed | |
.highlight('content') // Automatically highlights the words that matched our query | |
.get() // Specifies what kind of HTTP request are we going to make | |
.then(function(result) { | |
// Renders the result in the page | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment