Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!