How to print JSON rest api data on HTML list format by using typedata

41
August 10, 2018, at 3:10 PM

I am using typescript for showing live search my JSON rest API data is showing but I want to show the data on list format but using for loop is will show only one data Here is my code :

<div class="row">
<div class="col-md-12 text-center">
    <br/>
    <h1>Search Dynamic Autocomplete using Bootstrap Typeahead JS</h1>   
        <input class="typeahead form-control" style="margin:0px auto;width:300px;" type="text">
</div>

This is my HTML file where I am show the live search data

enter $(document).ready(function(){
$('input.typeahead').typeahead({
  source:  function (query, process) {
    return $.post('ip.php/test/search', { query: query }, function (data) {
        var res1 = [];
        res1 = JSON.stringify(data);
        for (var k=0;k<res1.length;k++) {
        var question = data[k].questionText ;    
        $(".row").("" +data[k].questionText);       
      }    
   });
 }

}); });

This is my typehead function in this I want to show all search data but it will showing the single result

READ ALSO
Weird label on Flask Bootstrap search bar

Weird label on Flask Bootstrap search bar

For some reason I am not able to get rid of this "search" label on my search bar:

51
How to add custom parameter parameter in python functions?

How to add custom parameter parameter in python functions?

My name is Piyush and I have just started learning to code in pythonRight now I am working on a project

60
Wagtail: Creating Recurring Events from Event page

Wagtail: Creating Recurring Events from Event page

I am creating a Wagtail site with an Events componentSome of these events are recurring, with the only difference being the start and end dates/times

39
How to filter list lines of a dictionary of lists according to a specific number?

How to filter list lines of a dictionary of lists according to a specific number?

I have a huge dictionary of lists that needs filteringHere's an example of its output:

36