Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jackie Jen
2,723 PointsHow to display the data in html label when user type in the textbox without refresh the page
I'm having an input textbox and add button. When user type words in the textbox. if the words is match with my database then it will automatically display on my label.
Right now i can connect to database and retrieve the data.since i'm using php i can't always referesh the page to check the user key in the words is match or not then display out on the label.
3 Answers
Sean T. Unwin
28,690 PointsYou could use a technique similar to how typeahead.js works and pre-populate an array from your database, either on load or using AJAX, then compare the input to the array.
Andrew Shook
31,709 PointsKenny you will need to use AJAX if you want to query your Database without refreshing the page. Treehouse has a course on AJAX here
Jackie Jen
2,723 PointsThanks Andrew and Sean, Now i have correct direction to go to. Thanks