In this article, we will see how to retrieve blog posts using our blog REST API and use a search bar to find them.
Let's see the result first 😎
Let's go, first of all, it is necessary to have a:
- Source code element of type jQuery.
- Cloud backend inputs element of type 'input text' to which we will give a 'search-input' name as in the image below.
In your 'Edit jquery code' block, you can paste this code :
Let's explain the essential elements of this code:
- We call the blog API 'https://api.appdrag.com/api.aspx' by passing it several data including the text (txt in the code) that the user types in the search bar.
- For each result we use a factory to generate each article (createLine (container, article) ).
Well played !