View Full Version : AJAX Search Box

Jun 18th, 2007, 01:42 AM
Hi all... I have seen it a million times but can't seem to find out how to do it, I am a total total noob to AJAX. When a new customer signs up on my website, they can pick a store which is closest to them. If they don't know which store that is, I want to have a textfield, which when they input their zip code into the name of the store associated with that zip code is written underneath the search box... I don't want them to have to click search just type in the zip code on the on the final number the result displays... I've set up a table in my databases which is called 'tblstorezip' and next to each zip is the appropriate store... If anyone can help of point me in the right direction would be much appreciated!

Jun 18th, 2007, 03:59 PM
well you would have to add onkeypress to the textbox and watch the length of the value [probably want to check for numeric too]

That you can fire off an Ajax request. Here is the basic article on Ajax: http://developer.apple.com/internet/webcontent/xmlhttpreq.html


Jun 22nd, 2007, 01:38 AM
Yep, that's the process - use JS onkeyprocess and count for a valid zip length - and don't forget to filter keys so you only get digits otherwise you might end up going to your DB with junk characters!