Skip to content

cold-world/autocomplete-from-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Autocomplete from api

HTML, CSS, JavaScript

Main goal -> Search + autocomplete data from api and custom html component without frameworks.


Alt Text


A piece of code

  const query = event.target.value;

  const options = {
    method: 'POST',
    mode: 'cors',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
      Authorization: 'Token ' + token,
    },
    body: JSON.stringify({ query }),
  };

  fetch(url, options)
    .then((response) => response.json())
    .then((result) => {
      renderResults(result);
      nameInput.focus();
    })
    .catch((error) => console.log('error', error));
};

Download & Installation

git clone https://github.com/cold-world/autocomplete-from-api.git

About

search + autocomplete data from api and custom html component without frameworks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published