Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
How do I link a json file to a search button so that a user can search up the data thru an identifier?

I've been given a JSON file and with it comes a list of over 1000 restaurant information from their names to their location but I don't know how I could link it to a search button where the user can simply try and search the restaurant and it will sort it out for them

`

function readTextFile(file, callback) {
    var rawFile = new XMLHttpRequest();
    rawFile.overrideMimeType("application/json");
    rawFile.open("GET", file, true);
    rawFile.onreadystatechange = function() {
        if (rawFile.readyState === 4 && rawFile.status == "200") {
            callback(rawFile.responseText);
        }
    }
    rawFile.send(null);
}
readTextFile("./walkuprestaurants.json", text => main(JSON.parse(text)))

function main(restaurants) {
  console.log(`${restaurants.length} restaurants loaded.`)
}

`

the JavaScript code above prints out in the console the number of restaurants loaded but now i don't know where to go from here and link it to a button on my website.

When user clicks button, turns into something user can input what they are looking for. they can then press the found result and be taken to a page that displays all information about said restaurant

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda