+ 1
Live search
Does someone know how to connect a tag from my html page to json data?
2 Antworten
+ 1
It sounds like you want to do some document manipulation using JavaScript to show data from JSON format. Based on the tags like 'searchbar' and 'live', it sounds like you want to filter some data based on a search query as the user types it.
Assuming your JSON data is coming from an API, you'd want to use JavaScript to send an HTTP request and process its response.
There are many ways to do this but it sounds like you're fairly new to JavaScript so I would recommend using jQuery.
Here is an interactive example that gets some data in JSON format and shows it by modifying the document:
https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_getjson
More specific to a search feature that updates the filtered results while typing, I would listen to the keyup event and show the results as the user types. If the Array of possible results data was under a few hundred on average, maintaining it and filtering it in clientside JavaScript would be great. If it is 1000 or more, that's roughly when you'd be better off putting all the filtering work in your server's API.
If you're a lot more advanced, you could get it working in vanilla JavaScript or with jQuery but might want to take things a step farther by using a library like KnockoutJS or a single page application framework.
0
Man i have maked whole live search.Only need to connect .html file to that json file.btw ty