How do I select the JSON elements I receive as Answer from a fetch API?

Asked

Viewed 8 times

0

In the following image this represented the answer that I receive when calling an API of the Solr server, I would like to take item by item and make available to the user a thumbnail with the video url and its description below.

inserir a descrição da imagem aqui

code used to receive Sponse:

const btn = document.querySelector('#search-submit');
const field = document.querySelector('#search');
const baseURI = 'http://localhost:8983/solr/csv_indexing';
btn.addEventListener('click', () => {
    const query = encodeURIComponent(field.value);
    const url = baseURI + '/select?q=' + query;
       fetch(url).then(response => {
          console.log(response);
          response.json().then(myList => {
              console.log(myList)
              })
       }).catch(error => {
          console.error(error);
       });
})

HTML:

<input id="search" type="text" name="" class="buscar-txt" placeholder="Pesquisar..."/>
<button type=button id="search-submit" class="buscar-btn">

How do I access these JSON values in a loop so that I can list the video thumbnails followed by their descriptions?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.